/* ==========================================
   Q-TRACK PORTAL IBU BAPA & MURID - STYLE.CSS
   ========================================== */

body {
    font-family: 'Fredoka', sans-serif;
    background-color: #fdfbf7;
    background-image: url('bg-masjid.png');
    background-position: center bottom;
    background-repeat: repeat-x;
    background-size: contain;
    background-attachment: fixed;
    -webkit-tap-highlight-color: transparent;
}

/* OPTIMASI MESRA PERANTI (RESPONSIVE MOBILE FIRST) */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Elak iOS Safari auto-zoom pada input & butang */
input, select, textarea, button {
    touch-action: manipulation;
    font-size: 16px !important;
}
@media (min-width: 768px) {
    input, select, textarea, button {
        font-size: 14px !important;
    }
}

.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}

.islamic-font {
    font-family: 'Amiri', serif;
}

/* --- TEMA KARTUN (NEO-BRUTALISM) OVERRIDES --- */
.bg-white, .glass-card, .bg-emerald-50, .bg-blue-50, .bg-gray-50, .bg-orange-50 {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border: 3px solid #000000 !important;
    border-radius: 16px !important;
    box-shadow: 5px 5px 0px #000000 !important;
    backdrop-filter: blur(8px) !important;
    margin-bottom: 12px;
}

header, nav {
    border-bottom: 4px solid #000000 !important;
    box-shadow: 0px 6px 0px #000000 !important;
    background-color: #059669 !important;
}

button, .btn {
    border: 3px solid #000000 !important;
    border-radius: 12px !important;
    box-shadow: 4px 4px 0px #000000 !important;
    transition: all 0.15s ease-in-out !important;
    font-weight: 700 !important;
}

button:hover, .btn:hover {
    transform: translate(-2px, -2px) !important;
    box-shadow: 6px 6px 0px #000000 !important;
}

button:active, .btn:active {
    transform: translate(4px, 4px) !important;
    box-shadow: 0px 0px 0px #000000 !important;
}

input, select, textarea {
    border: 3px solid #000000 !important;
    border-radius: 12px !important;
    box-shadow: 3px 3px 0px #000000 !important;
    font-family: 'Fredoka', sans-serif !important;
    font-weight: 600 !important;
    background-color: #ffffff !important;
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none !important;
    box-shadow: 5px 5px 0px #000000 !important;
    transform: translate(-1px, -1px);
}

table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 3px solid #000000 !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 5px 5px 0px #000000 !important;
    background: white !important;
    width: 100% !important;
}

thead {
    background-color: #fcd34d !important;
}

th, td {
    border-bottom: 2px solid #000000 !important;
    border-right: 2px solid #000000 !important;
}

th:last-child, td:last-child {
    border-right: none !important;
}

tr:last-child td {
    border-bottom: none !important;
}

span[class*="bg-"] {
    border: 2px solid #000000 !important;
    box-shadow: 2px 2px 0px #000000 !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
}

/* ==========================================
   REKA BENTUK MOD GELAP (DARK MODE) PERFECT CONTRAST & CLEAR TEXT
   ========================================== */
body.dark-mode {
    background-color: #0f172a !important;
    background-image: linear-gradient(rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.93)), url('bg-masjid.png') !important;
    background-position: center bottom !important;
    background-repeat: repeat-x !important;
    background-size: contain !important;
    background-attachment: fixed !important;
    color: #f8fafc !important;
}

body.dark-mode .bg-white,
body.dark-mode .glass-card {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
}

/* TAJUK & TEKS HIJAU TERANG DALAM DARK MODE */
body.dark-mode .text-emerald-900,
body.dark-mode .text-emerald-800,
body.dark-mode .text-emerald-700,
body.dark-mode .text-emerald-600 {
    color: #6ee7b7 !important; /* emerald-300 - Terang & Jelas */
}

body.dark-mode .text-blue-800,
body.dark-mode .text-blue-700,
body.dark-mode .text-blue-600 {
    color: #93c5fd !important; /* blue-300 */
}

/* PERKATAAN KELABU & SUB-LABEL TERANG JELAS */
body.dark-mode .text-gray-400,
body.dark-mode .text-gray-500,
body.dark-mode .text-gray-600,
body.dark-mode .text-gray-700,
body.dark-mode .text-gray-800,
body.dark-mode .text-gray-900 {
    color: #cbd5e1 !important; /* slate-300 */
}

/* KOTAK CONTAINER */
body.dark-mode .bg-emerald-50 { background-color: #064e3b !important; color: #6ee7b7 !important; }
body.dark-mode .bg-blue-50 { background-color: #1e3a8a !important; color: #93c5fd !important; }
body.dark-mode .bg-gray-50 { background-color: #334155 !important; color: #f8fafc !important; }

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background-color: #0f172a !important;
    color: #ffffff !important;
    border-color: #475569 !important;
}

body.dark-mode select:disabled,
body.dark-mode input:disabled {
    background-color: #1e293b !important;
    color: #94a3b8 !important;
}

body.dark-mode table {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
}

body.dark-mode th {
    background-color: #334155 !important;
    color: #ffffff !important;
    border-color: #475569 !important;
}

body.dark-mode td {
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.dark-mode tr:hover {
    background-color: #334155 !important;
}

body.dark-mode nav {
    background-color: #064e3b !important;
    border-color: #000000 !important;
}

.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #FFF;
    border-bottom-color: #10B981;
    border-radius: 50%;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* TETINGKAP POPUP (MODAL) TERTUTUP & FLOATING DI TENGAH SKRIN */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

/* ==========================================
   TEMA WARNA PORTAL (THEMES) - SAFE OVERRIDES
   ========================================== */
body.theme-navy nav {
    background-color: #1e3a8a !important; /* Navy Blue */
}
body.theme-navy .bg-emerald-600 {
    background-color: #1e40af !important;
}
body.theme-navy .bg-emerald-800 {
    background-color: #1e3a8a !important;
}
body.theme-navy .text-emerald-800,
body.theme-navy .text-emerald-900 {
    color: #1e3a8a !important;
}

body.theme-turquoise nav {
    background-color: #0f766e !important; /* Deep Teal */
}
body.theme-turquoise .bg-emerald-600 {
    background-color: #0d9488 !important;
}
body.theme-turquoise .bg-emerald-800 {
    background-color: #0f766e !important;
}
body.theme-turquoise .text-emerald-800,
body.theme-turquoise .text-emerald-900 {
    color: #0f766e !important;
}

/* CHAT WIDGET FAQ BUTTONS */
.portal-help-faq-btn {
    background: white;
    border: 1.5px solid #000000;
    color: #065f46;
    font-family: 'Fredoka', sans-serif;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 2px 2px 0px #000000;
    transition: all 0.1s;
}
.portal-help-faq-btn:hover {
    background: #059669;
    color: white;
    transform: translate(-1px, -1px);
}
