/* =============================================
   Todo List - Modern Dark Theme
   ============================================= */

/* CSS Variables */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --border-color: #30363d;
    --border-light: #484f58;
    
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-yellow: #d29922;
    --accent-red: #f85149;
    --accent-purple: #a371f7;
    
    --gradient-primary: linear-gradient(135deg, #58a6ff 0%, #a371f7 100%);
    --gradient-success: linear-gradient(135deg, #3fb950 0%, #56d364 100%);
    --gradient-danger: linear-gradient(135deg, #f85149 0%, #ff7b72 100%);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(88, 166, 255, 0.15);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(88, 166, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(163, 113, 247, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* App Wrapper */
.app-wrapper {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    padding: 2rem;
    animation: fadeInUp 0.6s var(--transition-slow);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    box-shadow: var(--shadow-md);
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Form */
.todo-form {
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

.task-input-wrapper {
    flex: 2;
    min-width: 200px;
}

.date-input-wrapper {
    min-width: 150px;
}

.input-wrapper input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-normal);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
}

/* Date input specific styling */
input[type="date"] {
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Add Button */
.btn-add {
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1.75rem;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-add:active {
    transform: translateY(0);
}

/* Error Message */
.error-message {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    padding-left: 0.25rem;
    min-height: 1.25rem;
    animation: shake 0.4s ease;
}

.error-message:empty {
    animation: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-group label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-select {
    padding: 0.625rem 2rem 0.625rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: all var(--transition-fast);
}

.filter-select:hover {
    border-color: var(--border-light);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Delete All Button */
.btn-delete-all {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: transparent;
    border: 1px solid var(--accent-red);
    border-radius: var(--radius-sm);
    color: var(--accent-red);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-delete-all:hover {
    background: var(--accent-red);
    color: white;
}

.btn-icon {
    font-size: 0.9rem;
}

/* Table Container */
.table-container {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* Table */
.todo-table {
    width: 100%;
    border-collapse: collapse;
}

.todo-table thead {
    background: var(--bg-primary);
}

.todo-table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-blue);
    border-bottom: 1px solid var(--border-color);
}

.th-task { width: 35%; }
.th-date { width: 20%; }
.th-status { width: 20%; }
.th-actions { width: 25%; text-align: center; }

.todo-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.todo-table tbody tr {
    transition: background var(--transition-fast);
}

.todo-table tbody tr:hover {
    background: var(--bg-hover);
}

.todo-table tbody tr:last-child td {
    border-bottom: none;
}

/* Task Cell */
.task-text {
    font-weight: 500;
    word-break: break-word;
}

.task-text.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Date Cell */
.date-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.date-text.overdue {
    color: var(--accent-red);
    font-weight: 500;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.pending {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-yellow);
}

.status-badge.completed {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-green);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.btn-action {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-complete {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-green);
}

.btn-complete:hover {
    background: var(--accent-green);
    color: white;
}

.btn-undo {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-blue);
}

.btn-undo:hover {
    background: var(--accent-blue);
    color: white;
}

.btn-delete {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-red);
}

.btn-delete:hover {
    background: var(--accent-red);
    color: white;
}

/* Empty State */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state.show {
    display: flex;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.empty-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Stats */
.stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.todo-table tbody tr {
    animation: fadeIn 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .app-wrapper {
        padding: 1.5rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-wrapper {
        flex: unset;
        width: 100%;
    }
    
    .task-input-wrapper,
    .date-input-wrapper {
        min-width: unset;
    }
    
    .btn-add {
        width: 100%;
        height: 45px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        justify-content: space-between;
    }
    
    .filter-select {
        flex: 1;
    }
    
    .btn-delete-all {
        justify-content: center;
    }
    
    /* Mobile Table */
    .table-container {
        overflow-x: auto;
    }
    
    .todo-table {
        min-width: 500px;
    }
    
    .stats {
        gap: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .app-wrapper {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }
    
    .tagline {
        font-size: 0.85rem;
    }
    
    .todo-table th,
    .todo-table td {
        padding: 0.75rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.375rem;
    }
    
    .btn-action {
        width: 100%;
        justify-content: center;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Focus Visible */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: rgba(88, 166, 255, 0.3);
    color: var(--text-primary);
}
