/* =========================================
   1. Reset & Base Styles
   ========================================= */
body {
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    background: var(--primary-gradient);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* =========================================
   2. Header
   ========================================= */
.header {
    background: var(--header-gradient);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    margin: 0;
    font-size: 2.5em;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header p {
    margin: 10px 0 0 0;
    opacity: 0.9;
    font-size: 1.1em;
}

/* =========================================
   3. Table Styles
   ========================================= */
.table-container {
    padding: 30px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th {
    background: var(--primary-gradient);
    color: white;
    padding: 15px 10px;
    text-align: center;
    font-weight: bold;
    font-size: 0.95em;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid #e8e8e8;
    font-size: 0.9em;
}

tr:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    transform: translateY(-1px);
    transition: var(--transition-fast);
}

.exam-name {
    font-weight: bold;
    color: var(--text-secondary);
    text-align: left;
    padding-left: 15px;
}

/* =========================================
   4. Status & Rates
   ========================================= */
.rate-high {
    background: var(--rate-high-bg);
}

.rate-medium {
    background: var(--rate-medium-bg);
}

.rate-low {
    background: var(--rate-low-bg);
}

.subject-list {
    text-align: left;
    font-size: 0.85em;
    line-height: 1.4;
}

.subject-item {
    margin: 2px 0;
    padding: 2px 0;
}

.weight {
    color: #666;
    font-weight: bold;
}

.date-cell {
    font-weight: 500;
    color: var(--text-main);
}

.update-time {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 0.9em;
    font-style: italic;
}

/* =========================================
   5. Components
   ========================================= */
.refresh-btn {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 20px auto;
    padding: 12px 20px;
    background: var(--rate-high-bg);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: var(--transition-normal);
    -webkit-tap-highlight-color: transparent;
}

.refresh-btn:active {
    transform: scale(0.95);
}

/* Countdown Styles */
.countdown {
    font-weight: bold;
    color: var(--text-main);
    font-size: 0.95em;
}

.countdown.countdown--urgent {
    color: var(--accent-red);
    animation: pulse 2s infinite;
}

.countdown.countdown--near {
    color: var(--accent-orange);
}

.countdown.countdown--far {
    color: var(--accent-green);
}

.countdown.countdown--today {
    color: var(--accent-blue);
    font-weight: 700;
}

.countdown.countdown--finished {
    color: #999;
    font-weight: 500;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* =========================================
   6. Media Queries
   ========================================= */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 10px;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .table-container {
        padding: 15px;
    }

    th,
    td {
        padding: 8px 5px;
        font-size: 0.8em;
    }

    .exam-name {
        padding-left: 8px;
    }
}