/* =============================================
   Birwa — Global CSS (HTML + Bootstrap + FA)
   ============================================= */

:root {
    /* Palet logo Birrul Waalidain Al-Aziziyah (logo.png) */
    --logo-navy: #004B63;
    --logo-navy-deep: #003040;
    --logo-teal: #008872;
    --logo-teal-bright: #00A7BA;
    --logo-green: #4AA94A;
    --logo-green-dark: #167A45;
    --logo-lime: #B2E045;
    --logo-lime-soft: #C8E86A;

    /* Alias kompatibilitas (nama lama → palet logo) */
    --logo-blue: var(--logo-teal-bright);
    --logo-blue-dark: var(--logo-navy);
    --logo-blue-deep: var(--logo-navy-deep);
    --logo-gold: var(--logo-lime);
    --logo-gold-soft: var(--logo-lime-soft);
    --logo-red: #C0392B;
    --logo-red-soft: #E57373;

    --primary: var(--logo-navy);
    --secondary: var(--logo-teal-bright);
    --gold: var(--logo-lime-soft);
    --white: #FFFFFF;
    --green: var(--logo-green);
    --orange: #E65100;
    --blue: var(--logo-teal-bright);
    --purple: #2E7D6B;
    --pink: var(--logo-green-dark);
    --teal: var(--logo-teal);
    --yellow: var(--logo-lime);
    --indigo: var(--logo-navy-deep);
    --shadow: 0 15px 40px rgba(0, 48, 64, 0.18);
    --radius: 25px;
}

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

html {
    min-height: 100%;
    background-color: var(--logo-navy-deep);
    background-image:
        radial-gradient(ellipse 130% 42% at 50% -8%, rgba(178, 224, 69, 0.2) 0%, transparent 58%),
        radial-gradient(ellipse 95% 45% at 50% 108%, rgba(0, 167, 186, 0.22) 0%, transparent 54%),
        linear-gradient(175deg, var(--logo-teal) 0%, var(--logo-navy) 50%, var(--logo-navy-deep) 100%);
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
}

body {
    background: transparent;
    color: white;
    min-height: 100vh;
    padding-bottom: 90px;
    position: relative;
}

/* Motif rosette Islami — susunan acak, emas, samar */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.09;
    background-image: url('../img/rosette-random.svg');
    background-repeat: repeat;
    background-size: 430px 720px;
    background-position: center -35px;
}

body > * {
    position: relative;
    z-index: 1;
}

.bottom-nav,
.page-back-float,
.flash-container {
    position: fixed;
    z-index: 1000;
}

body.login-page {
    padding-bottom: 0;
    overflow: hidden;
}

.login-scene {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.login-app-wrap {
    position: relative;
    z-index: 2;
}

.login-logo-bg {
    position: fixed;
    inset: 0;
    max-width: 430px;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.login-logo-float {
    position: absolute;
    height: auto;
    opacity: 0.07;
    animation: logoFloatSlow ease-in-out infinite;
    will-change: transform, opacity;
}

@keyframes logoFloatSlow {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.045;
    }
    25% {
        transform: translate(8px, -14px) rotate(6deg);
        opacity: 0.09;
    }
    50% {
        transform: translate(-6px, -22px) rotate(-4deg);
        opacity: 0.065;
    }
    75% {
        transform: translate(4px, -10px) rotate(3deg);
        opacity: 0.08;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-logo-float {
        animation: none;
        opacity: 0.06;
    }
}

a {
    text-decoration: none;
    color: inherit;
}

/* Wrapper konten HP — bukan Bootstrap .container */
.app-wrap {
    width: 100%;
    max-width: 430px !important;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: transparent;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: var(--logo-navy-deep);
    border-top: 2px solid rgba(178, 224, 69, 0.4);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 14px 8px calc(14px + env(safe-area-inset-bottom));
    border-radius: 25px 25px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.58rem;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.3s;
}

.bottom-nav-icon-wrap {
    position: relative;
    display: inline-flex;
}

.bottom-nav-badge {
    position: absolute;
    top: -4px;
    right: -10px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--logo-green-dark);
    color: #fff;
    font-size: 0.5rem;
    font-weight: 700;
    text-align: center;
    border: 1px solid var(--logo-navy-deep);
}

.bottom-nav i {
    color: white;
    font-size: 22px;
    transition: color 0.3s;
}

.bottom-nav a.active,
.bottom-nav a.active i {
    color: var(--logo-gold) !important;
}

/* Flash messages */
.flash-container {
    position: fixed;
    top: 16px;
    right: 16px;
    left: 16px;
    z-index: 9999;
    max-width: 400px;
    margin-left: auto;
}

/* Page wrapper (halaman lain) */
.page-wrapper {
    max-width: 430px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 100px;
    min-height: 100vh;
}

.page-header {
    color: white;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-header p {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 4px;
}

.riwayat-photo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.card-white {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
    color: #222;
}

.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 15px;
    padding: 10px 20px;
    font-weight: 500;
}

.btn-floating {
    position: fixed;
    bottom: 100px;
    right: calc(50% - 195px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--primary);
    border: none;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    font-size: 24px;
}

.page-back-float {
    position: fixed;
    left: 50%;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 100;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 148px;
    padding: 12px 28px;
    border-radius: 999px;
    background: #fff;
    color: var(--primary, var(--logo-navy));
    border: 1px solid rgba(0, 75, 99, 0.12);
    box-shadow: 0 8px 28px rgba(0, 75, 99, 0.2);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.page-back-float:hover,
.page-back-float:focus {
    color: var(--primary, var(--logo-navy));
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 75, 99, 0.26);
}

.page-with-back-float {
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
}

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-bar input {
    flex: 1;
    border-radius: 12px;
    border: none;
    padding: 10px 16px;
}

.search-bar button {
    border-radius: 12px;
    border: none;
    background: var(--gold);
    color: var(--primary);
    padding: 10px 16px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.8rem;
}

.filter-chip.active {
    background: var(--gold);
    color: var(--primary);
}

.table thead {
    background: var(--primary);
    color: white;
}

.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
}

.badge-aktif { background: rgba(178, 224, 69, 0.25); color: var(--logo-green-dark); }
.badge-nonaktif { background: #f8d7da; color: #721c24; }

/* Login */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius);
    padding: 36px 28px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    color: #222;
}

.login-input {
    background: rgba(255, 255, 255, 0.72) !important;
    border-radius: 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    padding: 11px 14px !important;
    font-size: 0.875rem;
}

.login-card .logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    border-radius: 50%;
    margin-bottom: 12px;
    background: transparent;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
}

.login-input:focus {
    border-color: var(--logo-blue) !important;
    box-shadow: 0 0 0 3px rgba(0, 167, 186, 0.2) !important;
}

.login-card h1 {
    font-size: 1.45rem;
    line-height: 1.25;
    color: var(--primary);
    margin-bottom: 6px;
}

.login-welcome {
    color: #666;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.login-tagline {
    color: var(--logo-green, #2e7d32);
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 22px;
    line-height: 1.4;
    padding: 0 4px;
}

.login-prompt {
    color: #555;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 22px;
}

.login-subtitle {
    color: var(--gold);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.login-institution {
    color: #666;
    font-size: 0.75rem;
    margin-bottom: 24px;
}

.btn-login {
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 15px;
    padding: 12px;
    font-weight: 600;
    width: 100%;
}

.form-page label {
    font-weight: 500;
    font-size: 0.85rem;
}

.form-page .form-control,
.form-page .form-select {
    border-radius: 12px;
}

.santri-foto-preview img {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(0, 75, 99, 0.2);
    background: #f0f0f0;
}

.jenis-badge-ziyadah {
    background: rgba(74, 169, 74, 0.14);
    color: var(--logo-green-dark);
    border: 1px solid rgba(74, 169, 74, 0.35);
}

.jenis-badge-murojaah {
    background: rgba(0, 167, 186, 0.12);
    color: var(--logo-navy);
    border: 1px solid rgba(0, 167, 186, 0.35);
}

.jenis-badge-ujian {
    background: rgba(253, 126, 20, 0.14);
    color: #c05600;
    border: 1px solid rgba(253, 126, 20, 0.35);
}

.jenis-badge-tahsin {
    background: rgba(0, 136, 114, 0.14);
    color: #00695c;
    border: 1px solid rgba(0, 136, 114, 0.35);
}

.jenis-badge-iqro {
    background: rgba(0, 75, 99, 0.1);
    color: var(--logo-navy);
    border: 1px solid rgba(0, 75, 99, 0.28);
}

.nilai-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
}

.nilai-badge-lancar {
    background: rgba(178, 224, 69, 0.2);
    color: var(--logo-green-dark);
    border: 1px solid rgba(74, 169, 74, 0.35);
}

.nilai-badge-tidak {
    background: rgba(220, 53, 69, 0.12);
    color: #b71c1c;
    border: 1px solid rgba(220, 53, 69, 0.35);
}

@media print {
    .bottom-nav, .btn-floating, .page-back-float, .flash-container { display: none !important; }
}
