/* Modern CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Custom Properties */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --danger-color: #e53e3e;
    --warning-color: #ed8936;
    --info-color: #4299e1;
    --light-bg: #f7fafc;
    --white: #ffffff;
    --gray-100: #f7fafc;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e0;
    --gray-500: #718096;
    --gray-700: #4a5568;
    --gray-900: #2d3748;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Typography */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--gray-900);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.book-icon {
    font-size: 60px;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.header h1 {
    color: var(--gray-700);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.header p {
    color: var(--gray-500);
    font-size: 1.1rem;
}

/* Setup Section */
.setup-section {
    background: var(--gray-100);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.setup-section h3 {
    color: var(--gray-700);
    font-size: 1.25rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Form Groups */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-700);
}

.form-group select,
.form-group input[type="date"],
.form-group input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 16px;
    background: var(--white);
    transition: all 0.3s ease;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#customPages {
    margin-top: 15px;
    animation: slideDown 0.3s ease;
}

/* Book Info Display */
.book-info-display {
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    border: 1px solid var(--gray-200);
    animation: fadeIn 0.5s ease;
}

.book-info-display p {
    margin-bottom: 8px;
    font-size: 15px;
}

.book-info-display strong {
    color: var(--gray-700);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 48px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #c53030);
    color: var(--white);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(229, 62, 62, 0.3);
}

/* Progress Stats */
.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* Chart Container */
.chart-container {
    margin-bottom: 30px;
}

.chart-title {
    text-align: center;
    margin-bottom: 20px;
    color: var(--gray-700);
    font-size: 1.25rem;
    font-weight: 600;
}

.week-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.day-cell {
    aspect-ratio: 1;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--white);
    padding: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.day-cell:hover:not(.future) {
    transform: scale(1.05);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.day-cell.future:hover {
    transform: none;
    cursor: not-allowed;
}

.day-number {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
}

.day-date {
    font-size: 0.625rem;
    opacity: 0.8;
    line-height: 1;
    margin-top: 2px;
}

.day-cell.completed {
    background: linear-gradient(135deg, var(--success-color), #38a169) !important;
    color: var(--white) !important;
    border-color: #38a169 !important;
}

.day-cell.today {
    border-color: var(--primary-color) !important;
    border-width: 3px !important;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3) !important;
    background: var(--white) !important;
}

.day-cell.future {
    background: var(--gray-100) !important;
    color: var(--gray-500) !important;
    cursor: not-allowed !important;
}

.day-cell.missed {
    background: #fed7d7 !important;
    border-color: #fc8181 !important;
    color: var(--danger-color) !important;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.legend-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid;
}

.legend-box.completed {
    background: linear-gradient(135deg, var(--success-color), #38a169);
    border-color: #38a169;
}

.legend-box.today {
    background: var(--white);
    border-color: var(--primary-color);
    border-width: 3px;
}

.legend-box.missed {
    background: #fed7d7;
    border-color: #fc8181;
}

.legend-box.future {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

/* Action Buttons */
.action-buttons {
    text-align: center;
    margin-top: 30px;
}

/* Completed Message */
.completed-message {
    background: linear-gradient(135deg, #ffd700, #ffed4a);
    color: var(--gray-900);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    margin: 25px 0;
    font-weight: 700;
    font-size: 1.125rem;
    animation: pulse 2s infinite;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
    margin: 20px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { 
        opacity: 0;
        transform: translateY(-10px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 20px;
    }
    
    .progress-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .chart-grid {
        gap: 4px;
    }
    
    .day-cell {
        font-size: 0.625rem;
        padding: 2px;
    }
    
    .day-number {
        font-size: 0.75rem;
    }
    
    .day-date {
        font-size: 0.5rem;
    }
    
    .legend {
        gap: 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .book-icon {
        font-size: 50px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .progress-stats {
        grid-template-columns: 1fr;
    }
    
    .legend {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}