@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --sdn-red: #E53935;
    --sdn-orange: #FF9800;
    --sdn-yellow: #FFC107;
    --sdn-dark: #1a1a2e;
}

* { font-family: 'Nunito', sans-serif; }

.bg-sdn-gradient {
    background: linear-gradient(135deg, var(--sdn-red) 0%, var(--sdn-orange) 50%, var(--sdn-yellow) 100%);
}

.btn-sdn-primary {
    background: var(--sdn-yellow);
    color: #1a1a2e;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-sdn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }

.btn-sdn-secondary {
    background: white;
    color: var(--sdn-red);
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.btn-sdn-secondary:hover { border-color: var(--sdn-red); }

.btn-sdn-danger {
    background: var(--sdn-red);
    color: white;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
}

.card-sdn {
    background: white;
    border-radius: 1.25rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 1.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: #64748b;
    font-weight: 600;
    transition: all 0.2s;
}
.sidebar-link:hover, .sidebar-link.active {
    background: linear-gradient(135deg, rgba(229,57,53,0.1), rgba(255,193,7,0.1));
    color: var(--sdn-red);
}

.stat-card {
    border-radius: 1.25rem;
    padding: 1.5rem;
    color: white;
}
.stat-card.red { background: linear-gradient(135deg, #E53935, #FF5722); }
.stat-card.orange { background: linear-gradient(135deg, #FF9800, #FFC107); }
.stat-card.yellow { background: linear-gradient(135deg, #FFC107, #FFD54F); color: #1a1a2e; }
.stat-card.blue { background: linear-gradient(135deg, #1E88E5, #42A5F5); }

.badge-sdn {
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 9999px;
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    pointer-events: none;
}

.table-sdn { width: 100%; border-collapse: collapse; }
.table-sdn th { background: #f8fafc; padding: 0.75rem 1rem; text-align: left; font-weight: 700; color: #475569; font-size: 0.875rem; }
.table-sdn td { padding: 0.75rem 1rem; border-top: 1px solid #f1f5f9; }
.table-sdn tr:hover td { background: #fafafa; }

.form-input {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--sdn-orange); }

.form-label { display: block; font-weight: 600; color: #475569; margin-bottom: 0.375rem; font-size: 0.875rem; }

.alert-success { background: #dcfce7; color: #166534; padding: 0.75rem 1rem; border-radius: 0.75rem; margin-bottom: 1rem; }
.alert-error { background: #fee2e2; color: #991b1b; padding: 0.75rem 1rem; border-radius: 0.75rem; margin-bottom: 1rem; }
.alert-info { background: #dbeafe; color: #1e40af; padding: 0.75rem 1rem; border-radius: 0.75rem; margin-bottom: 1rem; }

.question-nav-btn {
    width: 2.5rem; height: 2.5rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    border: 2px solid #e2e8f0;
    background: white;
    cursor: pointer;
    transition: all 0.15s;
}
.question-nav-btn.answered { background: #dcfce7; border-color: #22c55e; color: #166534; }
.question-nav-btn.marked { background: #fef9c3; border-color: #eab308; color: #854d0e; }
.question-nav-btn.current { background: var(--sdn-orange); border-color: var(--sdn-orange); color: white; }

.timer-display {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--sdn-red);
    font-variant-numeric: tabular-nums;
}

/* Indikator simpan ujian — halus, tidak mengganggu fokus siswa */
.exam-protected {
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.exam-essay-input {
    user-select: text;
    -webkit-user-select: text;
}

.exam-watermark {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
    border-radius: inherit;
}

.exam-watermark span {
    position: absolute;
    white-space: nowrap;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.06);
    transform: rotate(-25deg);
    letter-spacing: 0.05em;
}

.exam-blur-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.exam-blur-overlay.active {
    opacity: 1;
}

.exam-security-hint {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    max-width: 18rem;
    padding: 0.5rem 0.875rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e2e8f0;
    border-left: 3px solid #fcd34d;
    border-radius: 0.625rem;
    font-size: 0.75rem;
    line-height: 1.4;
    color: #64748b;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 40;
    transition: opacity 0.7s ease;
}

.exam-print-hide .exam-protected,
.exam-print-hide .exam-watermark {
    visibility: hidden !important;
}

.exam-flag-green { background: #dcfce7; color: #166534; }
.exam-flag-yellow { background: #fef9c3; color: #854d0e; }
.exam-flag-red { background: #fee2e2; color: #991b1b; }

.exam-save-hint {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    max-width: 16rem;
    padding: 0.5rem 0.875rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e2e8f0;
    border-left: 3px solid #86efac;
    border-radius: 0.625rem;
    font-size: 0.75rem;
    line-height: 1.4;
    color: #64748b;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 40;
    pointer-events: none;
}

/* ─── Responsive global ─── */
html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
}

img, video, svg {
    max-width: 100%;
    height: auto;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap .table-sdn {
    min-width: 36rem;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.page-actions form {
    display: inline-flex;
}

.exam-question-content {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.exam-question-content img {
    max-width: 100% !important;
    height: auto !important;
}

.prose {
    max-width: 100%;
    overflow-wrap: anywhere;
}

[x-cloak] {
    display: none !important;
}

@media (max-width: 1023px) {
    .card-sdn {
        padding: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .btn-sdn-primary,
    .btn-sdn-secondary,
    .btn-sdn-danger {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 639px) {
    .card-sdn {
        padding: 0.875rem;
        border-radius: 1rem;
    }

    .table-sdn th,
    .table-sdn td {
        padding: 0.5rem 0.625rem;
        font-size: 0.8125rem;
    }

    .timer-display {
        font-size: 1.25rem;
    }

    .question-nav-btn {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.75rem;
    }

    .exam-security-hint {
        left: 0.5rem;
        right: 0.5rem;
        max-width: none;
        bottom: 4.5rem;
    }

    .exam-save-hint {
        left: 0.5rem;
        right: 0.5rem;
        max-width: none;
        bottom: 0.5rem;
    }

    .form-input {
        font-size: 16px; /* cegah zoom otomatis di iOS */
    }
}

@media (max-width: 380px) {
    .question-nav-btn {
        width: 2rem;
        height: 2rem;
        font-size: 0.6875rem;
    }
}

