/* =============================================
   RESET & BASE
   ============================================= */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =============================================
   CONTAINER
   ============================================= */

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =============================================
   HEADER
   ============================================= */

.site-header {
    background: #fff;
    border-bottom: 3px solid #c8102e;
    box-shadow: 0 2px 12px rgba(200, 16, 46, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    justify-content: center;
}

.header-logo {
    width: 72px;
    height: auto;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.header-text {
    text-align: center;
}

.header-title {
    font-size: clamp(18px, 3vw, 30px);
    font-weight: 800;
    color: #c8102e;
    letter-spacing: 0.5px;
    line-height: 1.2;
    text-transform: uppercase;
}

.header-subtitle a {
    margin-top: 4px;
    font-size: clamp(11px, 1.5vw, 14px);
    font-weight: 500;
    color: #7f8c8d;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* =============================================
   MAIN
   ============================================= */

.main-content {
    flex: 1;
    padding: 40px 0 60px;
}

/* =============================================
   PAGE HEADING
   ============================================= */

.page-heading {
    text-align: center;
    margin-bottom: 32px;
}

.page-heading__title {
    font-size: clamp(17px, 2.5vw, 24px);
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.3;
    letter-spacing: 0.3px;
}

.page-heading__year {
    margin-top: 6px;
    font-size: 15px;
    font-weight: 600;
    color: #c8102e;
    letter-spacing: 1px;
}

.page-heading__line {
    width: 70px;
    height: 4px;
    background: linear-gradient(90deg, #c8102e, #ff4d6d);
    border-radius: 10px;
    margin: 14px auto 0;
}

/* =============================================
   SEARCH CARD
   ============================================= */

.search-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    border: 1px solid #e8ecf0;
    overflow: hidden;
    margin-bottom: 28px;
    transition: box-shadow 0.2s;
}

.search-card:hover {
    box-shadow: 0 8px 32px rgba(200, 16, 46, 0.1);
}

.search-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #fff5f7 0%, #fff 100%);
    border-bottom: 1px solid #fce8ec;
}

.search-card__icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #c8102e, #e63950);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.3);
}

.search-card__label {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
}

.search-card__body {
    padding: 24px;
}

.input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input {
    flex: 1;
    height: 50px;
    padding: 0 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: #1a1a2e;
    background: #fafbfc;
    transition: all 0.2s ease;
    outline: none;
}

.search-input:focus {
    border-color: #c8102e;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(200, 16, 46, 0.08);
}

.search-input.is-valid {
    border-color: #16a34a;
    background: #f0fdf4;
}

.search-input.is-invalid {
    border-color: #dc2626;
    background: #fef2f2;
}

.search-input::placeholder {
    color: #adb5bd;
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 50px;
    padding: 0 28px;
    background: linear-gradient(135deg, #c8102e, #a50d25);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(200, 16, 46, 0.35);
}

.search-btn:hover {
    background: linear-gradient(135deg, #a50d25, #8a0b1f);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(200, 16, 46, 0.45);
}

.search-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(200, 16, 46, 0.3);
}

.search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.search-note {
    margin-top: 12px;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-note i {
    color: #c8102e;
    font-size: 12px;
}

.input-error {
    margin-top: 10px;
    font-size: 13px;
    color: #dc2626;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.2s ease;
}

/* =============================================
   LOADING
   ============================================= */

.loading-box {
    text-align: center;
    padding: 48px 0;
    color: #6b7280;
    font-size: 15px;
    font-weight: 500;
    animation: fadeIn 0.2s ease;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top-color: #c8102e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

/* =============================================
   RESULT AREA
   ============================================= */

.result-area {
    animation: fadeInUp 0.35s ease;
}

/* STATUS BANNER */

.status-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}

.status-banner.status-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #15803d;
}

.status-banner.status-notfound {
    background: #fff7ed;
    border: 1px solid #fcd34d;
    color: #92400e;
}

/* TABLE — giữ lại class nhưng ẩn đi, dùng result-card thay thế */

.table-wrap {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    border: 1px solid #e8ecf0;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.table-scroll { overflow-x: auto; }

/* =============================================
   KẾT QUẢ BANNER — dòng to TRÚNG TUYỂN / KHÔNG TRÚNG
   ============================================= */

.ketqua-banner {
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
}

.ketqua-banner--pass {
    background: #f0fdf4;
    color: #15803d;
}

.ketqua-banner--fail {
    background: #fff2f2;
    color: #c8102e;
}

/* =============================================
   RESULT CARD — layout dọc (label | value)
   ============================================= */

.result-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    border: 1px solid #e8ecf0;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    gap: 16px;
}

.result-row--last {
    border-bottom: none;
}

.result-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.result-value {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    text-align: right;
    word-break: break-word;
}

.result-value--mono {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

@media (max-width: 480px) {
    .result-row {
        padding: 14px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .result-value {
        text-align: left;
    }
}

/* BADGES */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.badge-major {
    background: #fff1f2;
    color: #c8102e;
    border: 1px solid #fecdd3;
}

.badge-campus {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* Phía Bắc — xanh dương */
.badge-campus--north {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* Phía Nam — xanh lá */
.badge-campus--south {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #86efac;
}

/* NOT FOUND */

.not-found-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    border: 1px solid #e8ecf0;
    padding: 60px 24px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.not-found-icon {
    width: 72px;
    height: 72px;
    background: #fff7f7;
    border: 2px solid #fecdd3;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: #c8102e;
}

.not-found-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 10px;
}

.not-found-desc {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.7;
}

/* =============================================
   FOOTER
   ============================================= */

.site-footer {
    background: linear-gradient(135deg, #c8102e 0%, #8a0b1f 100%);
    color: #fff;
    margin-top: auto;
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.footer-logo-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.footer-logo {
    width: 52px;
    height: auto;
    flex-shrink: 0;
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.3);
}

.footer-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-align: left;
}

.footer-eng {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
    text-align: left;
}

.footer-divider {
    width: 60px;
    height: 2px;
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-info p {
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    justify-content: center;
}

.footer-info p i {
    margin-top: 3px;
    flex-shrink: 0;
    opacity: 0.8;
}

.footer-bottom {
    background: rgba(0,0,0,0.15);
    text-align: center;
    font-size: 12px;
    padding: 10px 20px;
    opacity: 0.9;
}

/* =============================================
   ANIMATIONS
   ============================================= */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================
   RESPONSIVE — TABLET
   ============================================= */

@media (max-width: 768px) {
    .main-content {
        padding: 28px 0 48px;
    }

    .header-logo {
        width: 56px;
    }

    .search-card__body {
        padding: 18px;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .search-btn {
        justify-content: center;
        width: 100%;
    }

    .result-table tbody td:first-child {
        text-align: center;
    }
}

/* =============================================
   RESPONSIVE — MOBILE
   ============================================= */

@media (max-width: 480px) {
    .header-inner {
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }

    .header-title {
        font-size: 16px;
    }

    .page-heading__title {
        font-size: 16px;
    }

    .search-card__header {
        padding: 14px 16px;
    }

    .search-card__label {
        font-size: 15px;
    }

    .footer-logo-wrap {
        flex-direction: column;
        align-items: center;
    }

    .footer-name {
        text-align: center;
    }

    .footer-eng {
        text-align: center;
    }

    .footer-info p {
        font-size: 12px;
        text-align: left;
    }
}

/* =============================================
   CAPTCHA
   ============================================= */

.captcha-wrap {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #e2e8f0;
}

.captcha-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.captcha-label i {
    color: #c8102e;
    font-size: 13px;
}

.captcha-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Canvas image */
.captcha-canvas-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#captchaCanvas {
    display: block;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    cursor: default;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    background: #fff;
}

/* Refresh button */
.captcha-refresh {
    width: 36px;
    height: 36px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.captcha-refresh:hover {
    border-color: #c8102e;
    color: #c8102e;
    background: #fff5f7;
    transform: rotate(90deg);
}

.captcha-refresh:active {
    transform: rotate(180deg);
}

/* Input */
.captcha-input {
    height: 44px;
    min-width: 0;
    flex: 1;
    max-width: 200px;
    padding: 0 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 4px;
    color: #1a1a2e;
    background: #fafbfc;
    outline: none;
    transition: all 0.2s ease;
}

.captcha-input:focus {
    border-color: #c8102e;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(200, 16, 46, 0.08);
}

.captcha-input.is-valid {
    border-color: #16a34a;
    background: #f0fdf4;
}

.captcha-input.is-invalid {
    border-color: #dc2626;
    background: #fef2f2;
    animation: shake 0.35s ease;
}

.captcha-input::placeholder {
    letter-spacing: 1px;
    font-size: 13px;
    font-weight: 400;
    color: #adb5bd;
    font-family: inherit;
}

/* Shake animation for wrong captcha */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

/* Refresh icon spin animation */
.captcha-refresh.spinning i {
    animation: spinOnce 0.4s ease;
}

@keyframes spinOnce {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    .captcha-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .captcha-input {
        max-width: 100%;
        width: 100%;
    }
}