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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f4f7ff 0%, #d7e0ff 100%);
    min-height: 100vh;
    padding: clamp(12px, 4vw, 28px);
    color: #1f2937;
    transition: background 0.4s ease, color 0.4s ease;
}

body.dark-mode {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    color: #e5e7eb;
}

.container {
    width: min(100%, 760px);
    max-width: 760px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: clamp(16px, 4vw, 24px);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
    padding: clamp(18px, 4vw, 30px);
    border: 1px solid rgba(102, 126, 234, 0.14);
    backdrop-filter: blur(10px);
    transition: background 0.4s ease, border 0.4s ease, box-shadow 0.4s ease;
}

body.dark-mode .container {
    background: rgba(17, 24, 39, 0.95);
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

header.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

header h1 {
    color: #111827;
    font-size: clamp(1.75rem, 7vw, 2.25rem);
    margin-bottom: 6px;
    line-height: 1.1;
}

body.dark-mode header h1 {
    color: #f8fafc;
}

.subtitle {
    color: #475569;
    font-size: 1rem;
}

body.dark-mode .subtitle {
    color: #cbd5e1;
}

.theme-toggle {
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 999px;
    padding: 10px 16px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.9);
    color: #334155;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
    transition: transform 0.2s ease, background 0.3s ease, color 0.3s ease, border 0.3s ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 1);
}

body.dark-mode .theme-toggle {
    background: rgba(30, 41, 59, 0.95);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.35);
}

/* Input Section */
.input-section {
    margin-bottom: 28px;
}

.input-group {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 220px) max-content;
    gap: 12px;
    align-items: end;
}

.task-input,
.due-datetime-input,
.btn-add {
    border-radius: 16px;
}

.datetime-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.datetime-field span {
    color: #667eea;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

body.dark-mode .datetime-field span {
    color: #a5b4fc;
}

.task-input {
    min-width: 0;
    padding: 14px 18px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 16px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #ffffff;
}

body.dark-mode .task-input {
    background: rgba(15, 23, 42, 0.84);
    border-color: rgba(100, 116, 139, 0.35);
    color: #e2e8f0;
}

.task-input:focus,
.due-datetime-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.12);
}

.due-datetime-input {
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 16px;
    font-size: 0.96rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    background: #fafbff;
}

body.dark-mode .due-datetime-input {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(100, 116, 139, 0.35);
    color: #e2e8f0;
}

/* Buttons */
.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    min-height: 48px;
    max-width: 100%;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-add {
    background: linear-gradient(135deg, #5b79f8 0%, #6f63f7 100%);
    color: white;
    box-shadow: 0 14px 32px rgba(101, 113, 241, 0.18);
}

.btn-add:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 18px 34px rgba(101, 113, 241, 0.25);
}

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

.btn-clear {
    display: block;
    margin: 24px auto 0;
    background: #f97316;
    color: white;
    width: 100%;
    box-shadow: 0 10px 24px rgba(249, 115, 22, 0.2);
}

.btn-clear:hover {
    background: #ea580c;
}

body.dark-mode .btn-add {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.2);
}

body.dark-mode .btn-clear {
    background: #f97316;
    box-shadow: 0 10px 24px rgba(249, 115, 22, 0.18);
}

/* Notification Toggle */
.notification-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
    cursor: pointer;
    color: #666;
    font-weight: 600;
    user-select: none;
}

.notification-toggle input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.notification-toggle:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.65;
}

/* Notification Container */
.notification-container {
    margin-bottom: 20px;
}

.notification {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    overflow-wrap: anywhere;
    animation: slideIn 0.3s ease-out;
}

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

.notification.success {
    background: #4caf50;
    color: white;
    border-left: 4px solid #388e3c;
}

.notification.warning {
    background: #ff9800;
    color: white;
    border-left: 4px solid #f57c00;
}

.notification.danger {
    background: #f44336;
    color: white;
    border-left: 4px solid #d32f2f;
}

.notification.info {
    background: #2196f3;
    color: white;
    border-left: 4px solid #1976d2;
}

.notification-close {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Filter Section */
.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.filter-btn {
    flex: 1 1 120px;
    padding: 8px 16px;
    min-height: 44px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Stats */
.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    justify-content: center;
}

.stat-item {
    color: #666;
    font-size: 0.95em;
}

.stat-item strong {
    color: #667eea;
    font-size: 1.2em;
}

/* Task List */
.task-list {
    list-style: none;
    margin-bottom: 20px;
}

.task-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 10px 12px;
    padding: 15px;
    background: #f9f9f9;
    border-left: 4px solid #667eea;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.task-item:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
}

.task-item.completed {
    opacity: 0.6;
    border-left-color: #4caf50;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: #999;
}

.task-due-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.task-due-date {
    font-size: 0.85em;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    color: #666;
    overflow-wrap: anywhere;
}

.task-due-date.overdue {
    background: #ffebee;
    color: #d32f2f;
    font-weight: 600;
}

.task-due-date.due-soon {
    background: #fff3e0;
    color: #f57c00;
    font-weight: 600;
}

.task-time-remaining {
    font-size: 0.8em;
    color: #999;
    overflow-wrap: anywhere;
}

.task-time-remaining.overdue {
    color: #d32f2f;
    font-weight: 600;
}

.task-time-remaining.due-soon {
    color: #f57c00;
    font-weight: 600;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.task-text {
    min-width: 0;
    color: #333;
    font-size: 1em;
    overflow-wrap: anywhere;
}

.task-date {
    font-size: 0.8em;
    color: #999;
    white-space: nowrap;
}

.delete-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    min-height: 40px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s;
}

.delete-btn:hover {
    background: #ee5a52;
    transform: scale(1.05);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 1.1em;
}

/* Social Footer */
.social-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 18px;
    margin-bottom: 8px;
}

.social-btn {
    display: inline-flex;
    flex: 1 1 140px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    min-height: 44px;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    background: #333;
    font-weight: 700;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.social-btn svg { fill: white; }

.social-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

.social-btn.linkedin {
    background: linear-gradient(135deg,#0e76a8 0%, #0077b5 100%);
}

.social-btn.github {
    background: linear-gradient(135deg,#333 0%, #444 100%);
}

/* Hidden Elements */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 720px) {
    .input-group {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .btn-add {
        grid-column: 1 / -1;
        width: 100%;
    }

    .task-item {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .task-due-section {
        grid-column: 2 / -1;
        grid-row: 2;
        justify-self: start;
    }

    .task-date {
        grid-column: 2;
        grid-row: 3;
    }

    .delete-btn {
        grid-column: 3;
        grid-row: 1 / span 3;
        align-self: center;
    }
}

@media (max-width: 520px) {
    .stats {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    header.app-header {
        align-items: stretch;
        margin-bottom: 24px;
    }

    header.app-header > div,
    .theme-toggle {
        width: 100%;
    }

    .input-group {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .btn-add {
        grid-column: auto;
    }

    .filter-btn,
    .social-btn {
        flex-basis: calc(50% - 6px);
    }
}

@media (max-width: 420px) {
    body {
        padding: 8px;
    }

    .container {
        border-radius: 14px;
    }

    .filter-btn,
    .social-btn {
        flex-basis: 100%;
    }

    .task-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .task-due-section,
    .task-date {
        grid-column: 1 / -1;
    }

    .delete-btn {
        grid-column: 1 / -1;
        grid-row: auto;
        width: 100%;
    }
}
