/* --- RESET & VARIABLES --- */
:root {
    /* Light Mode (Professional Palette) */
    --bg-app: #F3F4F6;       /* Light Gray background */
    --bg-card: #FFFFFF;
    --text-primary: #111827; /* Near Black */
    --text-secondary: #6B7280; /* Gray 500 */
    --accent: #4F46E5;       /* Indigo 600 */
    --accent-hover: #4338CA;
    --border: #E5E7EB;
    --input-bg: #F9FAFB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

body.dark-mode {
    /* Dark Mode (Deep Slate) */
    --bg-app: #0F172A;
    --bg-card: #1E293B;
    --text-primary: #F9FAFB;
    --text-secondary: #94A3B8;
    --accent: #818CF8;       /* Indigo 400 */
    --accent-hover: #6366F1;
    --border: #334151;
    --input-bg: #0F172A;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding-top: 60px;
    padding-bottom: 40px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- LAYOUT --- */
.main-wrapper {
    width: 100%;
    max-width: 520px;
    padding: 0 20px;
}

.app-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

/* --- HEADER --- */
.header {
    display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 30px;
}
.header-controls {
    display: flex; gap: 10px;
}
.date-badge {
    font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-secondary); margin-bottom: 4px; display: block;
}
.header h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.5px; }

.theme-toggle, .btn-header {
    background: transparent; 
    border: 1px solid var(--border); 
    color: var(--text-secondary);
    width: 40px; height: 40px; 
    border-radius: 12px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; 
    font-size: 1.1rem;
    transition: all 0.2s;
}
.theme-toggle:hover, .btn-header:hover { 
    background: var(--input-bg); 
    color: var(--text-primary); 
    border-color: var(--accent); 
    transform: translateY(-2px);
}

/* --- PROGRESS --- */
.progress-section { margin-bottom: 32px; }
.progress-info { display: flex; justify-content: space-between; font-size: 0.9rem; font-weight: 500; margin-bottom: 8px; color: var(--text-secondary); }
.progress-percent { color: var(--accent); font-weight: 700; }
.progress-track { height: 8px; background: var(--input-bg); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 4px; }

/* --- INPUTS --- */
.input-group {
    background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 32px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

.input-wrapper { display: flex; align-items: center; padding: 0 12px; }
.input-icon { color: var(--text-secondary); margin-right: 12px; font-size: 0.9rem; }
#input-task {
    background: transparent; border: none; padding: 12px 0; width: 100%;
    color: var(--text-primary); font-size: 1rem; outline: none;
}
.controls-wrapper { display: flex; gap: 8px; padding-left: 36px; }

select {
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary);
    padding: 8px 12px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; cursor: pointer; outline: none;
}
.btn-primary {
    background: var(--accent); color: white; border: none; padding: 8px 20px;
    border-radius: 8px; font-weight: 600; font-size: 0.9rem; cursor: pointer;
    margin-left: auto; transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }

/* --- LIST --- */
.task-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }

li {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; display: flex; align-items: center; gap: 16px;
    transition: all 0.2s ease; cursor: grab; position: relative;
}
li:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
li.dragging { opacity: 0.4; border: 2px dashed var(--accent); background: var(--input-bg); cursor: grabbing; }

/* Custom Checkbox */
.check-circle {
    width: 22px; height: 22px; border: 2px solid var(--border); border-radius: 6px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    transition: all 0.2s; flex-shrink: 0;
}
.check-circle:hover { border-color: var(--accent); }
.check-circle i { opacity: 0; transform: scale(0.5); transition: all 0.2s; color: white; font-size: 12px; }

/* Completed State */
li.completed { background: var(--input-bg); opacity: 0.8; }
li.completed .check-circle { background: var(--accent); border-color: var(--accent); }
li.completed .check-circle i { opacity: 1; transform: scale(1); }
li.completed .task-text { text-decoration: line-through; color: var(--text-secondary); }

.task-content { flex: 1; }
.task-text { display: block; font-weight: 500; margin-bottom: 4px; color: var(--text-primary); }
.tag {
    font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 4px;
    background: #E0E7FF; color: #4338CA; display: inline-block;
}
body.dark-mode .tag { background: #312E81; color: #C7D2FE; }

.drag-handle { color: var(--border); cursor: grab; transition: color 0.2s; }
li:hover .drag-handle { color: var(--text-secondary); }

.delete-btn {
    background: transparent; border: none; color: var(--text-secondary);
    cursor: pointer; padding: 8px; border-radius: 6px; opacity: 0; transition: all 0.2s;
}
.delete-btn:hover { background: #FEF2F2; color: #EF4444; }
body.dark-mode .delete-btn:hover { background: #451a1a; }
li:hover .delete-btn { opacity: 1; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 40px 0; color: var(--text-secondary); }
.empty-state i { font-size: 2rem; margin-bottom: 10px; color: var(--border); }

/* ... (CODE LAMA TETAP SAMA) ... */

/* --- WELCOME SCREEN STYLES (NEW) --- */
.welcome-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: var(--bg-app); display: flex; justify-content: center; align-items: center;
    z-index: 999; transition: opacity 0.5s ease;
}

.welcome-card {
    background: var(--bg-card); padding: 40px; border-radius: 24px;
    box-shadow: var(--shadow-md); text-align: center; max-width: 400px; width: 90%;
    border: 1px solid var(--border);
}

.welcome-card h1 { font-size: 2rem; margin-bottom: 10px; color: var(--text-primary); }
.welcome-card p { color: var(--text-secondary); margin-bottom: 24px; }

.input-group-welcome { display: flex; flex-direction: column; gap: 12px; }
#username-input {
    background: var(--input-bg); border: 1px solid var(--border); padding: 14px;
    border-radius: 12px; font-size: 1rem; text-align: center; color: var(--text-primary); outline: none;
}
#username-input:focus { border-color: var(--accent); }

.btn-start {
    background: var(--accent); color: white; border: none; padding: 14px;
    border-radius: 12px; font-weight: 600; font-size: 1rem; cursor: pointer;
    transition: 0.2s;
}
.btn-start:hover { background: var(--accent-hover); transform: translateY(-2px); }

.fade-out { opacity: 0; pointer-events: none; }

/* --- APP FOOTER --- */
.app-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary); /* Ikut warna tema (dark/light otomatis) */
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.app-footer a:hover {
    text-decoration: underline;
}