/* ==========================
   FONT & ROOT VARIABLES
========================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: rgb(29, 105, 110);
    --primary-dark: #144e53;
    --primary-light: #3d8f94;
    --white: #ffffff;
    --bg: #f4f8f9;
    --text: #2d3436;
    --shadow: 0 15px 35px rgba(29, 105, 110, 0.08);
    --radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================
   PAGE BASE
========================== */
body:has(.hero) {
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ==========================
   CONTAINER & LAYOUT
========================== */
.hero .container,
section.container {
    width: 100%;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

section.container {
    padding-bottom: 100px;
}

.student-result-section {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px 100px;
}

.d-none {
    display: none !important;
}

/* ==========================
   HERO SECTION
========================== */
.hero {
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-dark)
    );
    padding: 160px 0 70px;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.06) 0%, transparent 45%);
    pointer-events: none;
}

.hero > .container {
    position: relative;
    z-index: 1;
}

/* Logo & Headers inside Hero */
.logo-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    gap: 20px;
}

.logo-wrapper > div {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.logo-wrapper h1,
.hero-title-area h1 {
    font-size: clamp(24px, 5vw, 38px);
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    line-height: 1.2;
}

.logo-wrapper p,
.hero-title-area p {
    opacity: 0.85;
    font-size: clamp(13px, 2.5vw, 16px);
    margin: 0;
    line-height: 1.4;
}

.logo {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.08) rotate(5deg);
}

/* ==========================
   HERO CARD
========================== */
.hero-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    padding: 35px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.12);
}

.hero-card h2 {
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 700;
    margin-bottom: 8px;
}

.hero-card > p {
    opacity: 0.85;
    margin-bottom: 25px;
    font-size: 15px;
    line-height: 1.5;
}

/* ==========================
   SEARCH BOX & AUTO-SUGGEST
========================== */
.search-area {
    position: relative;
}

.search-box {
    background: white;
    border-radius: 60px;
    display: flex;
    align-items: center;
    padding: 14px 22px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
    border: 2px solid transparent;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 8px 30px rgba(29, 105, 110, 0.2);
    transform: translateY(-2px);
}

.search-box i {
    color: var(--primary);
    font-size: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.search-box input {
    border: none;
    outline: none;
    width: 100%;
    min-width: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    background: transparent;
    font-family: inherit;
}

.search-box input::placeholder {
    color: #94a3b8;
}

#suggestions {
    background: white;
    margin-top: 10px;
    border-radius: 15px;
    overflow: hidden;
    display: none;
    box-shadow: 0 15px 35px rgba(29, 105, 110, 0.15);
    border: 1px solid rgba(29, 105, 110, 0.08);
    max-height: 250px;
    overflow-y: auto;
}

.suggestion {
    padding: 14px 20px;
    cursor: pointer;
    color: var(--text);
    font-size: 15px;
    transition: var(--transition);
    border-bottom: 1px solid #f1f3f4;
    text-align: left;
}

.suggestion:last-child {
    border-bottom: none;
}

.suggestion:hover {
    background: #eef8f8;
    color: var(--primary-dark);
    padding-left: 25px;
}

.suggestion.text-muted {
    cursor: default;
    color: #6c757d !important;
}

.suggestion.text-muted:hover {
    padding-left: 20px;
    background: white;
}

/* ==========================
   STUDENT CARD & DETAIL LAYOUT
========================== */
.student-card {
    background: white;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(29, 105, 110, 0.15);
    border: 1px solid rgba(29, 105, 110, 0.1);
    margin-top: 0;
    position: relative;
    z-index: 10;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.student-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
    background-size: 200% 100%;
    animation: gradientMove 3s ease infinite;
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.student-card.show {
    opacity: 1;
    transform: translateY(0);
}

/* Header */
.student-card__header {
    text-align: center;
    padding: 42px 36px 32px;
    background: linear-gradient(180deg, rgba(29, 105, 110, 0.08) 0%, rgba(29, 105, 110, 0.02) 100%);
    border-bottom: 1px solid rgba(29, 105, 110, 0.1);
    position: relative;
}

.student-card__avatar-wrap {
    margin-bottom: 20px;
    position: relative;
}

.student-card__name {
    font-size: clamp(1.4rem, 4.5vw, 1.8rem);
    font-weight: 800;
    color: var(--text);
    margin: 0 0 8px;
    line-height: 1.3;
    word-break: break-word;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.student-card__subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: #5a6b7c;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary-dark) 100%);
    color: white;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    box-shadow: 0 12px 32px rgba(29, 105, 110, 0.35);
    border: 5px solid white;
    outline: 3px solid rgba(29, 105, 110, 0.2);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Info grid */
.student-card__info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 28px 32px;
}

/* ==========================
   INFO BOX STYLING
========================== */
.info-box {
    background: linear-gradient(135deg, #f8fbfb 0%, #ffffff 100%);
    border: 1px solid rgba(29, 105, 110, 0.1);
    border-radius: 16px;
    padding: 18px 20px;
    min-height: 92px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.info-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary), var(--primary-light));
    opacity: 0;
    transition: var(--transition);
}

.info-box:hover {
    background: #fff;
    border-color: rgba(29, 105, 110, 0.25);
    box-shadow: 0 8px 24px rgba(29, 105, 110, 0.1);
    transform: translateY(-2px);
}

.info-box:hover::before {
    opacity: 1;
}

.info-box--highlight {
    background: linear-gradient(135deg, #e8f4f4 0%, #f0f9f9 100%);
    border-color: rgba(29, 105, 110, 0.2);
    grid-column: 1 / -1;
}

.info-box--highlight::before {
    opacity: 1;
}

.info-box label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--primary);
    margin-bottom: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.info-box label i {
    font-size: 0.9rem;
    opacity: 0.9;
}

.info-box span {
    display: block;
    font-size: 1.05rem;
    color: var(--text);
    font-weight: 700;
    line-height: 1.4;
    word-break: break-word;
}

.info-box--highlight span {
    font-size: 1.1rem;
    color: var(--primary-dark);
}

/* Attendance Rekap */
.student-card__attendance {
    padding: 24px 32px;
    border-top: 1px solid rgba(29, 105, 110, 0.12);
    background: #fff;
}

.student-card__attendance .table {
    font-size: 13px;
    margin-bottom: 0;
}

.student-card__attendance .table th {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted, #636e72);
    padding: 8px 6px;
}

.student-card__attendance .table td {
    padding: 10px 6px;
    vertical-align: middle;
}

.student-card__attendance .badge-status {
    font-size: 11px;
    padding: 4px 12px;
    font-weight: 700;
    display: inline-block;
}

/* Bottom: QR only */
.student-card__bottom {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border-top: 1px solid rgba(29, 105, 110, 0.12);
    background: linear-gradient(180deg, #fafcfd 0%, #f5f8f9 100%);
}

/* ==========================
   ATTENDANCE BOX & STATUS
========================== */
.attendance-box {
    padding: 32px 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(29, 105, 110, 0.12);
    position: relative;
}

.attendance-box label {
    display: block;
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--primary);
    margin-bottom: 14px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.attendance-time {
    margin: 12px 0 0;
    font-size: 0.85rem;
    color: #5a6b7c;
    line-height: 1.5;
    font-weight: 500;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 800;
    padding: 10px 26px;
    border-radius: 999px;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.badge-status.present {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge-status.absent {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ==========================
   QR CODE WRAPPER
========================== */
.student-card__qr {
    padding: 32px 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.qr-section-title {
    margin: 0 0 16px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.qr-wrapper {
    background: white;
    padding: 14px;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(29, 105, 110, 0.12);
    display: inline-block;
    border: 2px solid rgba(29, 105, 110, 0.15);
    line-height: 0;
    transition: var(--transition);
}

.qr-wrapper:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(29, 105, 110, 0.18);
}

.qr-wrapper img,
#qrcode img {
    display: block;
    width: 150px;
    height: 150px;
    border-radius: 8px;
}

.qr-guide {
    margin: 16px 0 0;
    max-width: 280px;
    font-size: 0.8rem;
    color: #5a6b7c;
    line-height: 1.6;
    font-weight: 500;
}

.qr-guide i {
    color: var(--primary);
    margin-right: 5px;
}

/* ==========================
   FLOAT BUTTON (SCANNER)
========================== */
.floating-btn {
    position: fixed;
    bottom: 35px;
    right: 35px;
    width: 65px;
    height: 65px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(29, 105, 110, 0.3);
    transition: var(--transition);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-btn:hover {
    transform: translateY(-5px) scale(1.08);
    background: var(--primary-dark);
    box-shadow: 0 12px 30px rgba(20, 78, 83, 0.4);
}

/* ==========================
   SCANNER MODAL (Bootstrap + custom show)
========================== */
#scannerModal.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

#scannerModal.modal.show {
    display: flex !important;
}

#scannerModal .modal-dialog {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

#scannerModal .modal-content {
    border: none;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
}

#scannerModal .modal-header {
    background: var(--primary);
    color: white;
    border-bottom: none;
    padding: 18px 24px;
}

#scannerModal .modal-title {
    color: white;
    font-size: 18px;
}

#scannerModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.85;
}

#scannerModal .btn-close:hover {
    opacity: 1;
}

#scannerModal .modal-body {
    padding: 24px;
    background: white;
}

#reader {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: none !important;
}

#reader video {
    border-radius: 12px;
    width: 100% !important;
    height: auto !important;
}

/* ==========================
   RESPONSIVE DESIGN
========================== */
@media (max-width: 768px) {
    .logo-wrapper {
        flex-direction: column;
        text-align: center;
        margin-bottom: 30px;
        gap: 15px;
    }

    .logo-wrapper > div {
        order: -1;
    }

    .logo {
        width: 70px;
        height: 70px;
    }

    .hero {
        padding: 130px 0 50px;
    }

    .hero-card {
        padding: 25px;
    }

    .student-result-section {
        padding-top: 28px;
        padding-bottom: 90px;
    }

    .student-card {
        border-radius: 20px;
    }

    .student-card__header {
        padding: 28px 20px 22px;
    }

    .student-card__info {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 12px;
    }

    .info-box {
        min-height: auto;
        padding: 14px 16px;
    }

    .info-box--highlight {
        grid-column: auto;
    }

    .student-card__attendance {
        padding: 20px;
    }

    .student-card__qr {
        padding: 22px 20px 28px;
    }

    .floating-btn {
        width: 58px;
        height: 58px;
        font-size: 22px;
        bottom: 25px;
        right: 25px;
    }

    section.container {
        padding-bottom: 90px;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 120px 0 40px;
    }

    .hero-card {
        padding: 20px 18px;
    }

    .search-box {
        padding: 12px 18px;
    }

    .search-box input {
        font-size: 15px;
    }
}
