:root {
    --primary-purple: #7e57c2;
    --accent-purple: #9575cd;
    --deep-teal: #0f766e;
    --soft-teal: #e0f2f1;
    --light-purple: #ede7f6;
    --cheerful-bg: #f8f6ff;
    --white: #ffffff;
    --text-dark: #2d2640;
    --text-muted: #6b637b;
    --gold: #ffd700;
    --success: #2e7d32;
    --danger: #c62828;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
}

[hidden] {
    display: none !important;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        linear-gradient(145deg, rgba(224, 242, 241, 0.72), transparent 38%),
        var(--cheerful-bg);
    color: var(--text-dark);
}

.parent-container {
    width: 100%;
    max-width: 500px;
}

.portal-card {
    width: 100%;
    padding: 30px;
    border: 1px solid #f0ebfa;
    border-radius: 24px;
    background: var(--white);
    box-shadow: 0 10px 30px rgba(126, 87, 194, 0.08);
}

.logo-header {
    margin-bottom: 25px;
    text-align: center;
}

.logo-header img {
    width: 96px;
    height: 96px;
    object-fit: contain;
    margin-bottom: 12px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.26);
}

.logo-header h1 {
    margin-bottom: 4px;
    color: var(--primary-purple);
    font-size: 22px;
    font-weight: 700;
}

.logo-header p,
.portal-footer p {
    color: var(--text-muted);
    font-size: 13px;
}

.input-section,
.qr-result-section,
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.input-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 600;
}

.input-group label i {
    color: var(--primary-purple);
}

.input-group input,
.input-group select {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 1.5px solid #e0d4f7;
    border-radius: 12px;
    outline: none;
    background: #faf8ff;
    color: var(--text-dark);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--primary-purple);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(126, 87, 194, 0.1);
}

.input-group input[readonly] {
    color: var(--text-muted);
}

.student-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 5;
    display: none;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #e0d4f7;
    border-radius: 12px;
    background: var(--white);
    box-shadow: 0 12px 25px rgba(45, 38, 64, 0.12);
}

.student-results.is-open {
    display: block;
}

.student-option {
    width: 100%;
    padding: 10px 13px;
    border: 0;
    border-bottom: 1px solid #f3effa;
    background: transparent;
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
}

.student-option:hover,
.student-option:focus {
    background: #faf8ff;
}

.student-option strong,
.student-option span {
    display: block;
}

.student-option strong {
    font-size: 13px;
}

.student-option span {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11.5px;
}

.form-message {
    min-height: 18px;
    color: var(--danger);
    font-size: 12.5px;
    font-weight: 600;
}

.btn-generate,
.btn-download,
.btn-reset {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-generate {
    min-height: 50px;
    padding: 14px;
    border: none;
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-purple));
    color: var(--white);
    box-shadow: 0 6px 18px rgba(126, 87, 194, 0.3);
    font-size: 14.5px;
}

.btn-generate:hover,
.btn-download:hover {
    transform: translateY(-1px);
}

.btn-generate:disabled,
.btn-download:disabled {
    opacity: 0.7;
    cursor: wait;
}

.btn-generate.is-loading {
    box-shadow: 0 6px 18px rgba(126, 87, 194, 0.18);
    transform: none;
}

.btn-generate.is-loading i {
    font-size: 15px;
}

.qr-result-section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.id-card-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border: 2px dashed var(--accent-purple);
    border-radius: 18px;
    background: linear-gradient(135deg, #fbf9ff 0%, #eef7f6 100%);
    text-align: center;
}

.card-brand {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #d1c4e9;
    text-align: left;
}

.card-brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 50%;
    flex: 0 0 auto;
}

.card-brand h2 {
    color: var(--primary-purple);
    font-size: 13px;
    font-weight: 700;
}

.card-brand span {
    color: var(--text-muted);
    font-size: 10.5px;
}

.qr-box {
    display: inline-block;
    padding: 15px;
    border-radius: 14px;
    background: var(--white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.qr-placeholder {
    width: 180px;
    height: 180px;
    display: grid;
    place-items: center;
}

.student-info-tag h3 {
    margin-bottom: 4px;
    color: var(--text-dark);
    font-size: 18px;
    font-weight: 700;
}

.student-info-tag p,
.student-info-tag small {
    display: block;
    color: var(--text-muted);
    font-size: 12.5px;
}

.class-tag {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 12px;
    border-radius: 20px;
    background: var(--deep-teal);
    color: var(--white) !important;
    font-size: 11px !important;
    font-weight: 500;
}

.btn-download {
    padding: 13px;
    border: none;
    background: var(--success);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.25);
    font-size: 14px;
}

.btn-reset {
    padding: 11px;
    border: 1px solid #d1c4e9;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
}

.btn-reset:hover {
    background: #f0ebfa;
    color: var(--text-dark);
}

.portal-footer {
    margin-top: 25px;
    text-align: center;
}

@media (max-width: 520px) {
    body {
        align-items: flex-start;
        padding: 14px;
    }

    .portal-card {
        padding: 22px;
        border-radius: 18px;
    }
}
