/**
 * 考试详情页面样式
 * WordPress Exam Plugin
 *
 * @package WP_Exam
 */

/* ============================================
   CSS Variables (遵循 WordPress 主题风格)
   ============================================ */
:root {
    --wp-exam-primary:       #2271b1;
    --wp-exam-primary-hover: #135e96;
    --wp-exam-success:        #00a32a;
    --wp-exam-success-bg:    #d4edda;
    --wp-exam-danger:         #d63638;
    --wp-exam-danger-bg:      #f8d7da;
    --wp-exam-warning:        #dba617;
    --wp-exam-warning-bg:     #fff3cd;
    --wp-exam-info:           #72aee6;
    --wp-exam-info-bg:        #cfe2ff;
    --wp-exam-secondary:       #f0f0f1;
    --wp-exam-secondary-hover:#e0e0e1;
    --wp-exam-text:           #1d2327;
    --wp-exam-text-light:     #50575e;
    --wp-exam-text-muted:     #646970;
    --wp-exam-border:         #c3c4c7;
    --wp-exam-border-light:   #dcdcde;
    --wp-exam-bg:             #f6f7f7;
    --wp-exam-white:          #ffffff;
    --wp-exam-shadow:         0 1px 3px rgba(0,0,0,.1);
    --wp-exam-shadow-md:      0 4px 6px rgba(0,0,0,.1);
    --wp-exam-shadow-lg:      0 10px 20px rgba(0,0,0,.1);
    --wp-exam-radius:         6px;
    --wp-exam-radius-lg:      12px;
    --wp-exam-font:           -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --wp-exam-transition:     all 0.2s ease;
}

/* ============================================
   Container
   ============================================ */
.wp-exam-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: var(--wp-exam-font);
    color: var(--wp-exam-text);
    line-height: 1.6;
}

/* ============================================
   Error / Empty State
   ============================================ */
.wp-exam-error {
    background: var(--wp-exam-white);
    border: 1px solid var(--wp-exam-border);
    border-radius: var(--wp-exam-radius);
    padding: 48px 24px;
    text-align: center;
}

.wp-exam-error p {
    font-size: 16px;
    color: var(--wp-exam-text-light);
    margin-bottom: 20px;
}

/* ============================================
   Detail Wrap
   ============================================ */
.wp-exam-detail-wrap {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ============================================
   Header
   ============================================ */
.wp-exam-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.wp-exam-header-left {}

.wp-exam-header-right {}

/* 返回按钮 */
.wp-exam-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--wp-exam-text-light);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--wp-exam-radius);
    border: 1px solid var(--wp-exam-border);
    background: var(--wp-exam-white);
    transition: var(--wp-exam-transition);
}

.wp-exam-btn-back:hover {
    background: var(--wp-exam-secondary);
    color: var(--wp-exam-text);
    text-decoration: none;
}

.wp-exam-btn-back .dashicons {
    font-size: 16px;
    line-height: 1.4;
}

/* 状态徽章 */
.wp-exam-status-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-exam-status-published {
    background: var(--wp-exam-success-bg);
    color: var(--wp-exam-success);
}

.wp-exam-status-draft {
    background: var(--wp-exam-secondary);
    color: var(--wp-exam-text-muted);
}

.wp-exam-status-closed {
    background: var(--wp-exam-warning-bg);
    color: var(--wp-exam-warning);
}

/* ============================================
   Main Content Area - 两列布局
   ============================================ */
.wp-exam-detail-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 桌面端两列布局 */
@media (min-width: 768px) {
    .wp-exam-detail-main {
        display: grid;
        grid-template-columns: 1fr 340px;
        align-items: start;
    }

    .wp-exam-info-primary {
        grid-row: 1 / 2;
    }
}

/* ============================================
   Info Card Base
   ============================================ */
.wp-exam-info-card {
    background: var(--wp-exam-white);
    border: 1px solid var(--wp-exam-border-light);
    border-radius: var(--wp-exam-radius-lg);
    box-shadow: var(--wp-exam-shadow);
    overflow: hidden;
}

/* ============================================
   Primary Info Card
   ============================================ */
.wp-exam-info-primary {
    padding: 28px;
}

.wp-exam-info-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.wp-exam-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--wp-exam-text);
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

.wp-exam-type-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--wp-exam-info-bg);
    color: var(--wp-exam-primary);
    white-space: nowrap;
}

.wp-exam-description {
    font-size: 15px;
    color: var(--wp-exam-text-light);
    line-height: 1.7;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--wp-exam-border-light);
}

.wp-exam-description p {
    margin: 0 0 8px;
}

.wp-exam-description p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Info Grid
   ============================================ */
.wp-exam-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

@media (min-width: 600px) {
    .wp-exam-info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .wp-exam-info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.wp-exam-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--wp-exam-bg);
    border-radius: var(--wp-exam-radius);
    transition: var(--wp-exam-transition);
}

.wp-exam-info-item:hover {
    background: var(--wp-exam-secondary);
}

.wp-exam-info-icon {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: var(--wp-exam-primary);
    flex-shrink: 0;
}

.wp-exam-info-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wp-exam-info-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--wp-exam-text-muted);
    white-space: nowrap;
}

.wp-exam-info-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--wp-exam-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Stats Card
   ============================================ */
.wp-exam-stats-card {
    padding: 24px;
}

.wp-exam-stats-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--wp-exam-text);
    margin: 0 0 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-exam-stats-title .dashicons {
    font-size: 18px;
    color: var(--wp-exam-primary);
}

.wp-exam-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.wp-exam-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px;
    background: var(--wp-exam-bg);
    border-radius: var(--wp-exam-radius);
    border: 1px solid var(--wp-exam-border-light);
}

.wp-exam-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--wp-exam-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}

.wp-exam-stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--wp-exam-text-muted);
}

/* ============================================
   Notice / Alert Boxes
   ============================================ */
.wp-exam-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--wp-exam-radius);
    font-size: 14px;
    margin-bottom: 16px;
}

.wp-exam-notice .dashicons {
    font-size: 20px;
    flex-shrink: 0;
}

.wp-exam-notice-warning {
    background: var(--wp-exam-warning-bg);
    color: #856404;
    border: 1px solid #ffeeba;
}

.wp-exam-notice-success {
    background: var(--wp-exam-success-bg);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wp-exam-notice-info {
    background: var(--wp-exam-info-bg);
    color: #084298;
    border: 1px solid #b6d4fe;
}

.wp-exam-notice-error {
    background: var(--wp-exam-danger-bg);
    color: #58151c;
    border: 1px solid #f1aeb5;
}

/* ============================================
   User Result (已参加时的成绩展示)
   ============================================ */
.wp-exam-user-result {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.wp-exam-result-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 40px;
    border-radius: var(--wp-exam-radius-lg);
    text-align: center;
}

.wp-exam-result-score.passed {
    background: var(--wp-exam-success-bg);
    border: 2px solid var(--wp-exam-success);
}

.wp-exam-result-score.failed {
    background: var(--wp-exam-danger-bg);
    border: 2px solid var(--wp-exam-danger);
}

.wp-exam-result-value {
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 6px;
}

.passed .wp-exam-result-value {
    color: var(--wp-exam-success);
}

.failed .wp-exam-result-value {
    color: var(--wp-exam-danger);
}

.wp-exam-result-label {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.passed .wp-exam-result-label {
    color: var(--wp-exam-success);
}

.failed .wp-exam-result-label {
    color: var(--wp-exam-danger);
}

/* ============================================
   Buttons
   ============================================ */
.wp-exam-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--wp-exam-font);
    line-height: 1.4;
    border-radius: var(--wp-exam-radius);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--wp-exam-transition);
    white-space: nowrap;
}

.wp-exam-btn .dashicons {
    font-size: 18px;
    line-height: 1.4;
}

.wp-exam-btn:hover {
    text-decoration: none;
}

/* Primary */
.wp-exam-btn-primary {
    background: var(--wp-exam-primary);
    color: var(--wp-exam-white);
}

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

/* Secondary */
.wp-exam-btn-secondary {
    background: var(--wp-exam-secondary);
    color: var(--wp-exam-text);
}

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

/* Info */
.wp-exam-btn-info {
    background: var(--wp-exam-info-bg);
    color: var(--wp-exam-primary);
    border: 1px solid var(--wp-exam-primary);
}

.wp-exam-btn-info:hover {
    background: var(--wp-exam-primary);
    color: var(--wp-exam-white);
}

/* Large */
.wp-exam-btn-large {
    padding: 14px 36px;
    font-size: 16px;
}

/* Disabled */
.wp-exam-btn:disabled,
.wp-exam-btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading state */
.wp-exam-btn.is-loading {
    position: relative;
    color: transparent !important;
}

.wp-exam-btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--wp-exam-white);
    border-radius: 50%;
    animation: wp-exam-spin 0.7s linear infinite;
}

@keyframes wp-exam-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Actions Area
   ============================================ */
.wp-exam-actions {
    background: var(--wp-exam-white);
    border: 1px solid var(--wp-exam-border-light);
    border-radius: var(--wp-exam-radius-lg);
    box-shadow: var(--wp-exam-shadow);
    padding: 28px;
}

.wp-exam-start-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.wp-exam-start-hint {
    font-size: 15px;
    color: var(--wp-exam-text-light);
    margin: 0;
}

.wp-exam-btn-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================
   Countdown
   ============================================ */
.wp-exam-countdown-wrap {
    text-align: center;
}

.wp-exam-countdown-wrap p {
    font-size: 14px;
    color: var(--wp-exam-text-muted);
    margin: 0 0 8px;
}

.wp-exam-countdown {
    font-size: 56px;
    font-weight: 900;
    color: var(--wp-exam-primary);
    line-height: 1;
    animation: wp-exam-pulse 1s ease-in-out infinite;
}

@keyframes wp-exam-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.1); opacity: 0.8; }
}

/* ============================================
   Responsive - Mobile
   ============================================ */
@media (max-width: 600px) {
    .wp-exam-container {
        padding: 16px 12px;
    }

    .wp-exam-title {
        font-size: 20px;
    }

    .wp-exam-info-primary {
        padding: 20px;
    }

    .wp-exam-actions {
        padding: 20px;
    }

    .wp-exam-btn-large {
        width: 100%;
        justify-content: center;
    }

    .wp-exam-btn-group {
        flex-direction: column;
        width: 100%;
    }

    .wp-exam-btn-group .wp-exam-btn {
        width: 100%;
        justify-content: center;
    }

    .wp-exam-result-value {
        font-size: 40px;
    }

    .wp-exam-stat-value {
        font-size: 22px;
    }

    .wp-exam-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Responsive - Tablet
   ============================================ */
@media (min-width: 601px) and (max-width: 767px) {
    .wp-exam-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .wp-exam-detail-main {
        display: flex;
        flex-direction: column;
    }
}

/* ============================================
   Accessibility
   ============================================ */
.wp-exam-btn:focus-visible {
    outline: 2px solid var(--wp-exam-primary);
    outline-offset: 2px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .wp-exam-detail-header,
    .wp-exam-actions {
        display: none;
    }

    .wp-exam-container {
        max-width: 100%;
        padding: 0;
    }
}
