/* state.css */

/* ===== QUIZ GRID ===== */
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.quiz-card {
    position: relative;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 20px;
    background: var(--color-white);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.quiz-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--shadow-blue-strong);
    border-color: var(--color-blue);
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
    gap: 12px;
    flex-wrap: wrap;
}

.quiz-card h3 {
    flex-grow: 1;
    font-size: 1.45rem;
    margin: 0;
    padding: 0;
    color: var(--color-blue);
    font-weight: 700;
}

.quiz-card p {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin: 8px 0 16px;
    text-align: right;
}

.quiz-card .start-quiz-btn, .quiz-card .start-practice-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: var(--color-blue);
    color: var(--color-white);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.05rem;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-sizing: border-box;
}

.quiz-card .start-quiz-btn:hover {
    background: var(--blue-hero-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.quiz-card .start-practice-btn:hover {
    background: var(--blue-hero-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px var(--shadow-blue-strong);
}

.quiz-card .start-practice-btn:disabled,
.quiz-card .start-practice-btn[disabled] {
    background: #9ca3af !important;
    color: #f3f4f6 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.quiz-card .start-practice-btn:disabled:hover,
.quiz-card .start-practice-btn[disabled]:hover {
    background: #9ca3af !important;
    transform: none !important;
}

/* Badge trạng thái */
.quiz-card.badge-none  { border-color: var(--color-muted); }
.quiz-card.badge-pass  { border-color: var(--color-green); box-shadow: 0 0 0 4px rgba(40,167,69,0.15); }
.quiz-card.badge-fail  { border-color: var(--color-red);   box-shadow: 0 0 0 4px var(--red-glow); }

/* ===== Badge icon (tích xanh / x đỏ) ở góc card ===== */
.quiz-card.quiz-status {
    position: relative; /* để định vị icon góc */
}

.quiz-card.badge-pass::after,
.quiz-card.badge-fail::after {
    content: "";
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    border: 2px solid var(--color-white);
    z-index: 2;
}

/* Dấu tích - đậu */
.quiz-card.badge-pass::after {
    background-color: var(--color-green);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 6L9 17l-5-5' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Dấu x - rớt */
.quiz-card.badge-fail::after {
    background-color: var(--color-red);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M18 6L6 18M6 6l12 12' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.quiz-time, .max-questions {
    background: var(--color-red);
    color: var(--color-white);
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 20px;
    gap: 4px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ===== QUIZ NOTICE ===== */
.quiz-notice-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
}

.quiz-notice {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: min(92vw, 540px);
    padding: 14px 40px 14px 16px;
    border-radius: 12px;
    color: #fff;
    display: flex;
    align-items: flex-start;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    animation: noticePopup 0.22s ease;
    box-sizing: border-box;
}

@keyframes noticePopup {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.93);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ===== Types ===== */
.notice-success {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}
.notice-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    box-shadow: 0 10px 36px rgba(243, 156, 18, 0.38);
}
.notice-error {
    background: linear-gradient(135deg, #BB133E, #8e0f2f);
}
.notice-info {
    background: linear-gradient(135deg, #002147, #1e3a8a);
}

#quiz-notice-msg {
    flex: 1;
    min-width: 0;
    font-size: 0.93rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.quiz-notice-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.15s, transform 0.15s;
}
.quiz-notice-close:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* ===== Action (unauthenticated / no_state) ===== */
.quiz-notice-text {
    flex: 1;
    min-width: 140px;
    line-height: 1.45;
}
.quiz-notice-text strong {
    font-size: 1rem;
    color: #fff;
    display: block;
    margin-bottom: 2px;
}
.quiz-notice-subtext {
    font-size: 0.82rem;
    opacity: 0.9;
    font-weight: 400;
}

.quiz-notice-action-btn {
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-red);
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.quiz-notice-action-btn:hover {
    background: #fff;
    transform: translateY(-1px);
}

/* ===== Mobile ===== */
@media (max-width: 480px) {
    .quiz-notice {
        padding: 12px 36px 12px 14px;
        border-radius: 10px;
    }
    .quiz-notice-text strong {
        font-size: 0.95rem;
    }
    .quiz-notice-subtext {
        font-size: 0.8rem;
    }
    .quiz-notice-action-btn {
        width: 100%;
        text-align: center;
        padding: 10px;
        margin-top: 6px;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .quiz-grid {
        /* grid-template-columns: repeat(2, 1fr); */
        gap: 10px;
    }

    .quiz-card {
        padding: 10px 16px;
    }

    .quiz-header h3 { font-size: 1.25rem; }
}