/* style.css - Task Manager Pro
   Tombol ukuran normal, mobile friendly, full fitur
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f7fb;
    padding: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* ========== HEADER ========== */
.header {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    gap: 12px;
}

.header h1 {
    font-size: 20px;
    margin-bottom: 4px;
    color: #333;
}

.header p {
    color: #666;
    font-size: 13px;
}

/* Header Links */
.header-links {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: #4f46e5;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: #eef2ff;
}

.logout-btn {
    background: #fee2e2;
    color: #dc2626;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #fecaca;
}

/* ========== STATS ROW ========== */
.stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-item {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    min-width: 80px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.stat-label {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}

.stat-item.danger .stat-value {
    color: #ef4444;
}

.stat-item.warning .stat-value {
    color: #f59e0b;
}

/* ========== TABS ========== */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 10px;
    text-decoration: none;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid #e5e7eb;
}

.tab.active {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

.tab:hover:not(.active) {
    background: #f3f4f6;
}

/* ========== CARD UMUM ========== */
.card, .task-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.task-card {
    transition: box-shadow 0.2s;
}

.task-card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.card-late {
    border-left: 3px solid #ef4444;
}

/* ========== FORM ========== */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: #4f46e5;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* ========== TOMBOL - UKURAN NORMAL ========== */
.btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: #4f46e5;
    color: white;
}

.btn-primary:hover {
    background: #4338ca;
}

.btn-secondary {
    background: #9ca3af;
    color: white;
}

.btn-secondary:hover {
    background: #6b7280;
}

.btn-delete {
    background: #ef4444;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    display: inline-block;
}

.btn-delete:hover {
    background: #dc2626;
}

.btn-edit {
    background: #f59e0b;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    display: inline-block;
}

.btn-edit:hover {
    background: #d97706;
}

.btn-submit {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: #059669;
}

.btn-block {
    width: 100%;
}

/* ========== ALERT ========== */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 3px solid #10b981;
}

.alert-danger {
    background: #fee2e2;
    color: #dc2626;
    border-left: 3px solid #ef4444;
}

/* ========== TASK CARD ========== */
.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.task-title h3 {
    font-size: 16px;
    margin-bottom: 6px;
    color: #333;
}

.task-meta {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.deadline, .created-at {
    font-size: 11px;
    color: #666;
    display: inline-block;
}

.text-danger {
    color: #ef4444;
}

.task-desc {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    padding: 8px 0;
    border-top: 1px solid #f0f0f0;
    line-height: 1.4;
}

/* Reminder Banner */
.reminder-banner {
    background: #fef3c7;
    color: #92400e;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    border-left: 3px solid #f59e0b;
}

/* Task Actions */
.task-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ========== PROGRESS BAR ========== */
.progress-section {
    margin: 12px 0;
}

.progress-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.progress-bar {
    background: #e5e7eb;
    border-radius: 20px;
    height: 6px;
    overflow: hidden;
}

.progress-fill {
    background: #4f46e5;
    height: 100%;
    border-radius: 20px;
    transition: width 0.3s;
}

/* ========== ADD SUBTASK FORM ========== */
.add-subtask {
    margin: 12px 0;
    padding: 12px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.inline-form {
    display: flex;
    gap: 8px;
}

.inline-form input {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.inline-form input:focus {
    outline: none;
    border-color: #4f46e5;
}

/* ========== SUBTASKS LIST ========== */
.subtasks-list {
    margin-top: 8px;
}

.subtask-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
    gap: 12px;
    flex-wrap: wrap;
}

.subtask-item:last-child {
    border-bottom: none;
}

.subtask-name {
    font-size: 13px;
    flex: 1;
    word-break: break-word;
}

.subtask-item.selesai .subtask-name {
    text-decoration: line-through;
    color: #9ca3af;
}

.subtask-item.pending .subtask-name {
    color: #f59e0b;
}

.subtask-status select {
    padding: 6px 10px;
    font-size: 11px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

.subtask-status select:focus {
    outline: none;
    border-color: #4f46e5;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 12px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    color: #666;
}

.empty-sub {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.empty-subtasks {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 12px;
}

/* ========== LOGIN PAGE ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    max-width: 350px;
    width: 100%;
}

.logo {
    font-size: 48px;
    margin-bottom: 16px;
}

.login-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #333;
}

.login-card .subtitle {
    color: #666;
    font-size: 13px;
    margin-bottom: 24px;
}

.register-link {
    margin-top: 20px;
    font-size: 13px;
}

.register-link a {
    color: #4f46e5;
    text-decoration: none;
}

.register-link a:hover {
    text-decoration: underline;
}

/* ========== CALENDAR STYLES ========== */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.calendar-nav h2 {
    font-size: 18px;
    color: #333;
}

.nav-arrow {
    font-size: 18px;
    text-decoration: none;
    padding: 6px 14px;
    background: #f3f4f6;
    border-radius: 8px;
    color: #333;
    transition: background 0.2s;
}

.nav-arrow:hover {
    background: #e5e7eb;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: white;
    border-radius: 12px 12px 0 0;
    text-align: center;
    padding: 10px 0;
    font-weight: bold;
    font-size: 12px;
    color: #666;
    border-bottom: 1px solid #e5e7eb;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: white;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.calendar-day {
    min-height: 100px;
    border: 1px solid #f0f0f0;
    padding: 6px;
    position: relative;
    background: white;
}

.calendar-day.empty {
    background: #fafafa;
}

.calendar-day.today {
    background: #eef2ff;
}

.calendar-day.has-tasks {
    background: #fefce8;
}

.day-number {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #555;
}

.day-tasks {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.day-task {
    background: #e0e7ff;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.2s;
    word-break: break-word;
}

.day-task:hover {
    background: #c7d2fe;
}

.day-task.task-late {
    background: #fee2e2;
    color: #dc2626;
}

.day-task-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.day-task-progress {
    font-size: 9px;
    color: #666;
    margin-top: 2px;
}

.calendar-legend {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    padding: 12px;
    background: white;
    border-radius: 12px;
    font-size: 11px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-color.today {
    background: #eef2ff;
    border: 1px solid #4f46e5;
}

.legend-color.has-tasks {
    background: #fefce8;
    border: 1px solid #e5e7eb;
}

.legend-color.task-late {
    background: #fee2e2;
    border: 1px solid #ef4444;
}

/* ========== DETAIL PAGE ========== */
.detail-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-label {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    color: #333;
    word-break: break-word;
}

.detail-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.detail-row .detail-section {
    flex: 1;
    min-width: 120px;
}

/* ========== HISTORY LIST ========== */
.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap;
}

.history-item:last-child {
    border-bottom: none;
}

.history-time {
    font-size: 11px;
    color: #999;
    min-width: 100px;
}

.history-action {
    font-size: 13px;
    color: #333;
}

/* ========== RESPONSIVE (Mobile First) ========== */
@media (max-width: 600px) {
    body {
        padding: 12px;
    }
    
    .container {
        max-width: 100%;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .task-header {
        flex-direction: column;
    }
    
    .task-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .inline-form {
        flex-direction: column;
    }
    
    .btn-submit {
        padding: 8px;
    }
    
    .stats-row {
        gap: 8px;
    }
    
    .stat-item {
        padding: 8px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    /* Calendar responsive */
    .calendar-day {
        min-height: 65px;
        padding: 4px;
    }
    
    .day-number {
        font-size: 10px;
    }
    
    .day-task {
        font-size: 8px;
        padding: 2px 3px;
    }
    
    .day-task-name {
        white-space: normal;
        word-break: break-word;
        line-height: 1.2;
    }
    
    .calendar-weekdays div {
        font-size: 10px;
    }
    
    .calendar-nav h2 {
        font-size: 14px;
    }
    
    .nav-arrow {
        padding: 4px 10px;
        font-size: 14px;
    }
    
    .detail-row {
        flex-direction: column;
        gap: 0;
    }
    
    .history-item {
        flex-direction: column;
        gap: 4px;
    }
    
    .history-time {
        min-width: auto;
    }
    
    .tabs {
        gap: 6px;
    }
    
    .tab {
        padding: 8px;
        font-size: 11px;
    }
}

/* ========== TABLET (600px - 900px) ========== */
@media (min-width: 601px) and (max-width: 900px) {
    .container {
        max-width: 90%;
    }
    
    .calendar-day {
        min-height: 85px;
    }
}

/* ========== LANDSCAPE MODE ========== */
@media (max-width: 900px) and (orientation: landscape) {
    .calendar-day {
        min-height: 55px;
    }
    
    .day-tasks {
        display: none;
    }
    
    .calendar-day.has-tasks::after {
        content: "📋";
        font-size: 10px;
        position: absolute;
        bottom: 4px;
        right: 4px;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-card {
    animation: fadeIn 0.3s ease;
}

.alert {
    animation: fadeIn 0.3s ease;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Tambahan CSS untuk riwayat selesai */

/* Completed Badge */
.completed-badge {
    background: #10b981;
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
    display: inline-block;
}

.completed-at {
    font-size: 11px;
    color: #10b981;
    display: inline-block;
    margin-left: 12px;
}

/* Stat item success */
.stat-item.success .stat-value {
    color: #10b981;
}

/* Status Badge untuk riwayat */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
}

.status-proses {
    background: #e0e7ff;
    color: #4f46e5;
}

.status-pending {
    background: #fef3c7;
    color: #d97706;
}

.status-selesai {
    background: #d1fae5;
    color: #065f46;
}

/* Button Warning */
.btn-warning {
    background: #f59e0b;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    display: inline-block;
}

.btn-warning:hover {
    background: #d97706;
}