/* CSS Variables for consistent theming */
:root {
    --primary-color: #7868E6;
    --secondary-color: #B8B5FF;
    --accent-color: #FFB4B4;
    --background-color: #EDEEF7;
    --light-background: #E4FBFF;
    --white: #FFFFFF;
    --text-primary: #2C2C2C;
    --text-secondary: #666666;
    --text-light: #999999;
    --border-color: #E0E0E0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Paper texture effect */
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(120, 104, 230, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(184, 181, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(255, 180, 180, 0.1) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header__title {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header__icon {
    font-size: 2rem;
}

.header__nav {
    display: flex;
    gap: 1rem;
}

.nav__link {
    color: var(--white);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 500;
}

.nav__link:hover,
.nav__link--active {
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

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

/* Section titles */
.section-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
}

/* Status section */
.status-section {
    margin-bottom: 3rem;
}

.status-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.status-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.status-card__title {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.status-card__content {
    margin-bottom: 2rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.status-indicator__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #4CAF50;
    animation: pulse 2s infinite;
}

.status-indicator__dot.active {
    background-color: var(--accent-color);
}

.status-indicator__text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.timer-display {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    min-width: 160px;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn--primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.btn--primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

.btn--secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn--outline {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

.btn__icon {
    font-size: 1.1rem;
}

/* Analysis section */
.analysis-section {
    margin-bottom: 3rem;
}

.analysis-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.analysis-card__title {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
}

.chart-container {
    margin-bottom: 1.5rem;
    text-align: center;
}

.chart-container canvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    background: var(--light-background);
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.analysis-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--light-background);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.stat-item__label {
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-item__value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Tips section */
.tips-section {
    margin-bottom: 3rem;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.tip-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.tip-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.tip-card__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tip-card__icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-background);
    border-radius: 50%;
}

.tip-card__title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.tip-card__description {
    color: var(--text-secondary);
    line-height: 1.6;
}

.tip-card__steps {
    list-style: none;
    margin-top: 1rem;
}

.tip-card__steps li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.tip-card__steps li:last-child {
    border-bottom: none;
}

/* History section */
.history-section {
    margin-bottom: 3rem;
}

.history-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.week-display {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 150px;
    text-align: center;
}

.history-calendar {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.calendar-header-cell {
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--light-background);
    cursor: pointer;
    transition: var(--transition);
    padding: 0.5rem;
}

.calendar-day:hover {
    background: var(--secondary-color);
    color: var(--white);
}

.calendar-day--today {
    background: var(--primary-color);
    color: var(--white);
    font-weight: 600;
}

.calendar-day--has-episodes {
    background: var(--accent-color);
    color: var(--white);
}

.calendar-day__number {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.calendar-day__episodes {
    font-size: 0.8rem;
    opacity: 0.8;
}

.history-summary {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.summary-item {
    text-align: center;
    padding: 1rem;
    background: var(--light-background);
    border-radius: var(--border-radius);
}

.summary-item__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.summary-item__label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.notification {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-hover);
    border-left: 4px solid var(--primary-color);
    animation: slideIn 0.3s ease;
}

.notification--success {
    border-left-color: #4CAF50;
}

.notification--error {
    border-left-color: var(--accent-color);
}

.notification--warning {
    border-left-color: #FF9800;
}

.notification__title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.notification__message {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.notification__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-light);
}

/* FAQ Styles */
.faq-section {
    margin-bottom: 3rem;
}

.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--white);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1.5rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--light-background);
}

.faq-icon {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--primary-color);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer p {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.contact-section {
    margin-bottom: 3rem;
}

.contact-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.contact-card p:last-child {
    margin-bottom: 0;
}

/* Footer */
.footer {
    background: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer__text {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header__title {
        font-size: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .analysis-stats {
        grid-template-columns: 1fr;
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .calendar-grid {
        gap: 0.5rem;
    }
    
    .calendar-day {
        padding: 0.25rem;
        font-size: 0.9rem;
    }
    
    .history-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .notification-container {
        top: 80px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .main {
        padding: 1rem 0;
    }
    
    .status-card,
    .analysis-card,
    .history-calendar,
    .history-summary {
        padding: 1rem;
    }
    
    .timer-display {
        font-size: 1.5rem;
    }
    
    .calendar-day__episodes {
        font-size: 0.7rem;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .header__nav,
    .action-buttons,
    .notification-container {
        display: none;
    }
    
    .main {
        padding: 0;
    }
    
    .status-card,
    .analysis-card,
    .history-calendar {
        box-shadow: none;
        border: 1px solid #000;
    }
}
