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

:root {
    --color-bg: #f8f6f3;
    --color-surface: #ffffff;
    --color-primary: #2d5a4a;
    --color-primary-hover: #1e3d32;
    --color-text: #2c3e50;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-success: #059669;
    --color-accent: #d4a574;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
    font-size: 14px;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

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

.logo {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.logo-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-name {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Buttons - Compact */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

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

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

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

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

/* Container - Mobile First */
.container {
    padding: 0.75rem;
    flex: 1;
    width: 100%;
}

/* Tracker Card */
.tracker-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: white;
}

.card-header label {
    font-weight: 500;
    font-size: 0.875rem;
}

.month-select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-text);
    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 24 24' fill='none' stroke='%232c3e50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 2rem;
}

.month-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Days List - Compact */
.days-list {
    padding: 0.25rem 0;
}

.day-item {
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.1s ease;
}

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

.day-item:active {
    background: var(--color-bg);
}

.day-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    user-select: none;
}

/* Checkbox - Compact */
.day-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--color-success);
    cursor: pointer;
    flex-shrink: 0;
}

.day-number {
    font-weight: 600;
    color: var(--color-primary);
    min-width: 1.5rem;
    font-size: 0.8125rem;
}

.day-passage {
    flex: 1;
    color: var(--color-text);
    font-size: 0.8125rem;
}

/* Completed State - Strikethrough */
.day-item.completed .day-passage {
    text-decoration: line-through;
    color: var(--color-text-muted);
}

.day-item.completed .day-number {
    color: var(--color-text-muted);
}

.day-item.completed {
    background: #f8fdf9;
}

/* Progress Card - Compact */
.progress-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 0.75rem;
    margin-top: 0.75rem;
}

.progress-header {
    margin-bottom: 0.5rem;
}

.progress-text {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

.progress-text strong {
    color: var(--color-text);
}

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

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

/* Footer - Compact */
.footer {
    text-align: center;
    padding: 0.75rem;
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

/* Tablet and up (min-width: 640px) */
@media (min-width: 640px) {
    html {
        font-size: 15px;
    }

    .header {
        padding: 0.875rem 1.25rem;
    }

    .header-content {
        max-width: 700px;
        margin: 0 auto;
    }

    .logo {
        font-size: 1.125rem;
    }

    .logo-icon {
        width: 1.75rem;
        height: 1.75rem;
    }

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

    .user-name {
        font-size: 0.8125rem;
        max-width: 150px;
    }

    .container {
        max-width: 700px;
        margin: 0 auto;
        padding: 1.25rem;
    }

    .card-header {
        padding: 1rem 1.25rem;
    }

    .month-select {
        max-width: 180px;
    }

    .day-label {
        padding: 0.5rem 1rem;
        gap: 0.75rem;
    }

    .day-checkbox {
        width: 1.25rem;
        height: 1.25rem;
    }

    .day-number {
        min-width: 1.75rem;
        font-size: 0.875rem;
    }

    .day-passage {
        font-size: 0.875rem;
    }

    .progress-card {
        padding: 1rem 1.25rem;
        margin-top: 1rem;
    }

    .footer {
        padding: 1rem;
    }
}

/* Desktop (min-width: 1024px) */
@media (min-width: 1024px) {
    html {
        font-size: 16px;
    }

    .header-content {
        max-width: 800px;
    }

    .container {
        max-width: 800px;
        padding: 1.5rem;
    }

    .day-label {
        padding: 0.625rem 1.25rem;
    }

    .day-item:hover {
        background: var(--color-bg);
    }
}

/* Loading state for HTMX */
.htmx-request {
    opacity: 0.7;
    pointer-events: none;
}

.htmx-request .day-checkbox {
    animation: pulse 0.8s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Touch optimization */
@media (hover: none) {
    .day-item:hover {
        background: transparent;
    }
    
    .day-item:active {
        background: var(--color-bg);
    }
}
