/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary:        #012763;
    --primary-dark:   #011d4a;
    --primary-light:  #eef3fb;
    --primary-ring:   rgba(1, 39, 99, 0.14);
    --accent:         #C9952A;
    --border:         #e5e7eb;
    --border-strong:  #d1d5db;
    --text:           #111827;
    --text-muted:     #6b7280;
    --text-soft:      #9ca3af;
    --bg-body:        #f4f5f9;
    --white:          #ffffff;
    --radius-xs:      6px;
    --radius-sm:      10px;
    --radius-md:      14px;
    --radius-lg:      18px;
    --shadow-card:    0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg:      0 20px 50px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.05);
    --transition:     0.18s ease;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(160deg, #eef3fb 0%, #f3f6fc 50%, #f8fafc 100%);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 44px 16px 64px;
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */
.page-wrapper {
    width: 100%;
    max-width: 556px;
}

.container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 36px 32px 28px;
    border-top: 4px solid var(--primary);
}

/* ===== BRAND HEADER ===== */
.brand-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.brand-seal {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(1,39,99,0.28);
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 500;
}

.divider {
    height: 1px;
    background: var(--border);
    margin-bottom: 22px;
}

/* ===== FORM ===== */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 13px;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    z-index: 1;
}

input[type="text"] {
    width: 100%;
    padding: 12px 40px 12px 40px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-strong);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fafafa;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]::placeholder {
    color: var(--text-soft);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.clear-btn {
    position: absolute;
    right: 9px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-soft);
    padding: 5px;
    border-radius: var(--radius-xs);
    display: none;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
    line-height: 1;
}

.clear-btn:hover {
    color: var(--text);
    background: var(--border);
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding-left: 1px;
}

.hint strong {
    color: var(--text);
    font-weight: 600;
}

/* ===== PRIMARY BUTTON ===== */
.btn-primary {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.01em;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(1,39,99,0.28);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== SPINNER ===== */
.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    display: none;
    flex-shrink: 0;
}

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

/* ===== DATA RANGE ===== */
.data-range {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    min-height: 18px;
}

/* ===== RESULT AREA ===== */
.result {
    margin-top: 18px;
    display: none;
    animation: fadeUp 0.22s ease;
}

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

/* ===== ALERT STATES (error / warning / not-found) ===== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.55;
    border: 1px solid;
}

.alert-icon {
    flex-shrink: 0;
    margin-top: 1px;
    font-size: 15px;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-info {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0c4a6e;
}

/* ===== RESULT CARD ===== */
.result-card {
    border-radius: var(--radius-md);
    border: 2px solid;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.result-card-header {
    padding: 15px 18px 14px;
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.result-icon {
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 1px;
}

.result-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.result-tagline {
    font-size: 10.5px;
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    opacity: 0.65;
    font-weight: 500;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 13px;
    margin: 0 18px 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.result-card-body {
    padding: 14px 18px 18px;
    font-size: 14px;
    line-height: 1.7;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.info-grid {
    display: grid;
    gap: 4px;
}

.info-row {
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.info-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.55;
    min-width: 104px;
    flex-shrink: 0;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
}

.semesters-section {
    margin-top: 12px;
}

.semesters-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.55;
    margin-bottom: 6px;
}

.chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chip {
    padding: 5px 13px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid;
}

/* ===== HISTORY ===== */
.history-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-soft);
    padding: 10px 18px 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    transition: color var(--transition);
    width: 100%;
    text-align: left;
}

.history-toggle:hover {
    color: var(--text-muted);
}

.history-list {
    display: none;
    margin: 2px 16px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    overflow: hidden;
    font-size: 13px;
}

.history-row {
    padding: 9px 13px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text);
}

.history-row:last-child {
    border-bottom: none;
}

.history-row.is-latest {
    font-weight: 600;
}

.history-latest-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== DISCLAIMER ===== */
.disclaimer-box {
    margin-top: 24px;
}

.consent-text {
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 10px;
    line-height: 1.55;
}

.warning-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-xs);
    padding: 12px 15px;
    font-size: 12.5px;
    color: #78350f;
    line-height: 1.6;
}

.warning-icon {
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 1px;
    color: #d97706;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    body {
        padding: 20px 12px 48px;
        align-items: flex-start;
    }

    .container {
        padding: 26px 20px 22px;
    }

    .brand-seal {
        width: 44px;
        height: 44px;
        font-size: 17px;
    }

    .brand-name {
        font-size: 14px;
    }

    .info-label {
        min-width: 90px;
    }
}

@media (max-width: 360px) {
    .info-row {
        flex-direction: column;
        gap: 1px;
    }

    .info-label {
        min-width: unset;
    }
}
