* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background: #0f172a;
    min-height: 100vh;
    color: #e2e8f0;
    line-height: 1.5;
}

/* Login Section */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 420px;
    width: 90%;
    border: 1px solid #374151;
    backdrop-filter: blur(16px);
}

.login-card h1 {
    color: #f8fafc;
    margin-bottom: 0.75rem;
    font-weight: 700;
    font-size: 2rem;
    background: linear-gradient(135deg, #f8fafc, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-card p {
    color: #cbd5e1;
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

/* Main App */
.main-container {
    min-height: 100vh;
    background: #0f172a;
}

.header {
    background: #1e293b;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #334155;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #f1f5f9;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #3b82f6;
}

/* Stats Dashboard */
.stats-dashboard {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: #1e293b;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border: 1px solid #374151;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    border-color: #3b82f6;
}

.stat-card h3 {
    color: #f8fafc;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
}

.progress-container {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.progress-fill.reading {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}

.progress-fill.study {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
}

.streak-info {
    display: flex;
    justify-content: space-around;
}

.streak-item {
    text-align: center;
}

.streak-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: #3b82f6;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.estimate-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.estimate-item:last-child {
    margin-bottom: 0;
}

.estimate-item strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #f1f5f9;
    font-weight: 600;
}

.estimate-item div {
    font-size: 0.9rem;
    color: #cbd5e1;
    margin-bottom: 0.25rem;
}

.estimate-item small {
    color: #94a3b8;
    font-style: italic;
}

/* Books Container */
.books-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

/* Testament Sections */
.testament-section {
    margin-bottom: 2rem;
}

.testament-header {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    border: 1px solid #374151;
    border-bottom: none;
}

.testament-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -2px rgba(0, 0, 0, 0.4);
    border-color: #3b82f6;
}

.testament-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.testament-count {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: normal;
}

.testament-icon {
    transition: transform 0.3s ease;
    font-size: 1.2rem;
}

.testament-books {
    background: #1e293b;
    border-radius: 0 0 12px 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    border: 1px solid #374151;
    border-top: none;
}

.testament-books.collapsed {
    display: none;
}

.testament-books .book {
    margin-bottom: 0.5rem;
}

.testament-books .book:last-child {
    margin-bottom: 0;
}

.book {
    background: #334155;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    border: 1px solid #475569;
    transition: all 0.2s ease;
}

.book:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
    border-color: #3b82f6;
}

.book-header {
    padding: 1.25rem 1.75rem;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.book-header:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.book-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.book-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.mini-progress {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.mini-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.mini-progress-fill.reading {
    background: #fff;
}

.mini-progress-fill.study {
    background: #f093fb;
}

.expand-icon {
    transition: transform 0.3s ease;
}

.book.collapsed .expand-icon {
    transform: rotate(-90deg);
}

.book.collapsed .chapters-container {
    display: none;
}

.chapters-container {
    padding: 1rem;
    background: #475569;
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.75rem;
}

.chapter {
    border: 1px solid #64748b;
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
    position: relative;
    background: #1e293b;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.chapter:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
    border-color: #3b82f6;
}

.chapter-number {
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chapter-dates {
    margin: 0.5rem 0;
    min-height: 45px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.65rem;
    line-height: 1.2;
}

.date-item {
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

.read-date {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

.study-date {
    background: rgba(245, 87, 108, 0.15);
    color: #f5576c;
}

.chapter-actions {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    position: relative;
    z-index: 999;
    pointer-events: none;
}

.chapter-actions * {
    pointer-events: auto;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1000;
    pointer-events: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.action-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: subtract;
}

.action-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.action-btn:active {
    transform: translateY(0) scale(0.95);
    transition: all 0.1s ease;
}

.action-btn.read {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    border: 1px solid #3b82f6;
}

.action-btn.read::after {
    content: '📖';
    font-size: 16px;
    filter: grayscale(100%) brightness(0) invert(1);
}

.action-btn.read.completed {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.action-btn.read.completed::after {
    content: '✓';
    font-size: 18px;
    font-weight: bold;
    filter: none;
}

.action-btn.study {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: white;
    border: 1px solid #f59e0b;
}

.action-btn.study::after {
    content: '📚';
    font-size: 16px;
    filter: grayscale(100%) brightness(0) invert(1);
}

.action-btn.study.completed {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.action-btn.study.completed::after {
    content: '✓';
    font-size: 18px;
    font-weight: bold;
    filter: none;
}

.action-btn.notes {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
    border: 1px solid #8b5cf6;
}

.action-btn.notes::after {
    content: '📝';
    font-size: 16px;
    filter: grayscale(100%) brightness(0) invert(1);
}

.action-btn.notes.has-notes {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.5), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.action-btn.notes.has-notes::after {
    content: '📋';
    font-size: 16px;
    filter: none;
}

/* Subtle pulse animation for completed states */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 16px rgba(59, 130, 246, 0.5), 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

@keyframes pulse-glow-amber {
    0%, 100% {
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 16px rgba(245, 158, 11, 0.5), 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

@keyframes pulse-glow-purple {
    0%, 100% {
        box-shadow: 0 0 8px rgba(139, 92, 246, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 16px rgba(139, 92, 246, 0.5), 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

.action-btn.read.completed {
    animation: pulse-glow 2s ease-in-out infinite;
}

.action-btn.study.completed {
    animation: pulse-glow-amber 2s ease-in-out infinite;
}

.action-btn.notes.has-notes {
    animation: pulse-glow-purple 2s ease-in-out infinite;
}


.chapter-status {
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    gap: 2px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.status-dot.read {
    background: #3b82f6;
}

.status-dot.study {
    background: #f59e0b;
}

/* Buttons */
.btn {
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: subtract;
}

.btn-primary {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    border: 1px solid #3b82f6;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px);
    transition: all 0.1s ease;
}

.btn-secondary {
    background: linear-gradient(135deg, #475569, #64748b);
    color: white;
    border: 1px solid #64748b;
    box-shadow: 0 4px 8px rgba(71, 85, 105, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #374151, #475569);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(71, 85, 105, 0.4);
}

.btn-secondary:active {
    transform: translateY(-1px);
    transition: all 0.1s ease;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    border-radius: 8px;
}

/* Export and Print specific styles */
#export-csv::before {
    content: '📄';
    font-size: 16px;
}

#print-view::before {
    content: '🖨️';
    font-size: 16px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body textarea {
    width: 100%;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    font-family: inherit;
    resize: vertical;
}

.modal-body textarea:focus {
    outline: none;
    border-color: #667eea;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .header, .stats-dashboard, .action-btn {
        display: none !important;
    }
    
    .book-header {
        background: #333 !important;
        color: white !important;
    }
    
    .chapter {
        border: 1px solid #333;
        break-inside: avoid;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .stats-dashboard {
        grid-template-columns: 1fr;
        margin: 1rem auto;
        padding: 0 1rem;
    }
    
    .books-container {
        padding: 0 1rem 2rem;
    }
    
    .chapters-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    
    .chapter {
        padding: 0.5rem;
        min-height: 100px;
    }
    
    .chapter-dates {
        font-size: 0.6rem;
        min-height: 30px;
    }
    
    .chapter-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.5rem;
    }
    
    .book-progress {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.8rem;
    }
    
    .chapters-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}