/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.2s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

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

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 9999px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 100px;
    text-align: right;
}

/* Main Content */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Controls */
.controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background);
    border-color: var(--secondary-color);
}

.btn-danger {
    background: var(--surface);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.btn-danger:hover {
    background: var(--danger-color);
    color: white;
}

/* Checklist Grid */
.checklist-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Checklist Section */
.checklist-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    background: var(--surface);
}

.section-header:hover {
    background: var(--background);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-icon {
    font-size: 1.5rem;
}

.section-title h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-progress {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--background);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

.toggle-icon {
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.section-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.section-content {
    padding: 0 1.25rem 1.25rem;
    display: block;
}

.section-content.hidden {
    display: none;
}

/* Checklist Group */
.checklist-group {
    margin-bottom: 1.25rem;
}

.checklist-group:last-child {
    margin-bottom: 0;
}

.checklist-group h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Checklist Item */
.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    margin: 0.25rem 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.checklist-item:hover {
    background: var(--background);
}

.checklist-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checklist-item input:checked ~ .checkmark {
    background: var(--success-color);
    border-color: var(--success-color);
}

.checklist-item input:checked ~ .checkmark::after {
    display: block;
}

.checklist-item input:focus ~ .checkmark {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.item-text {
    flex: 1;
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.checklist-item input:checked ~ .item-text {
    color: var(--text-secondary);
    text-decoration: line-through;
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
}

.footer p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 300px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .logo {
        justify-content: center;
    }

    .progress-container {
        justify-content: center;
    }

    .progress-bar {
        width: 150px;
    }

    .controls {
        justify-content: center;
    }

    .btn {
        flex: 1;
        min-width: 120px;
    }

    .section-header {
        padding: 0.875rem 1rem;
    }

    .section-title h2 {
        font-size: 1rem;
    }

    .section-content {
        padding: 0 1rem 1rem;
    }

    .checklist-item {
        padding: 0.5rem;
    }

    .item-text {
        font-size: 0.875rem;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .progress-text {
        font-size: 0.75rem;
        min-width: 80px;
    }

    .controls {
        gap: 0.5rem;
    }

    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    .section-meta {
        gap: 0.5rem;
    }

    .section-progress {
        font-size: 0.75rem;
        padding: 0.125rem 0.5rem;
    }
}

/* Dark mode support (prefers-color-scheme) */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border-color: #334155;
    }

    .checklist-item:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .section-header:hover {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* Print styles */
@media print {
    .header {
        position: static;
    }

    .controls {
        display: none;
    }

    .section-content {
        display: block !important;
    }

    .checklist-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .footer {
        margin-top: 2rem;
    }

    .toast {
        display: none;
    }
}

/* Animation for checkbox */
@keyframes checkmark-pop {
    0% {
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.checklist-item input:checked ~ .checkmark {
    animation: checkmark-pop 0.2s ease;
}

/* Celebration animation for 100% completion */
@keyframes celebrate {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.progress-container.complete .progress-bar {
    animation: celebrate 0.5s ease;
}

.progress-container.complete .progress-text {
    color: var(--success-color);
}
