/* ==========================================
   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);
}

/* AI Auto-Navigator Glow Effect */
@keyframes aiGlowPulse {
    0% { box-shadow: 0 0 0 0px rgba(16, 185, 129, 0.8), 0 0 20px rgba(16, 185, 129, 0.6); transform: scale(1.01); }
    50% { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0), 0 0 35px rgba(16, 185, 129, 0.9); transform: scale(1.02); }
    100% { box-shadow: 0 0 0 0px rgba(16, 185, 129, 0), 0 0 0px rgba(16, 185, 129, 0); transform: scale(1); }
}
.ai-glow-highlight {
    animation: aiGlowPulse 1.2s ease-in-out 2 !important;
    border-color: #10b981 !important;
    border-width: 3px !important;
    position: relative;
    z-index: 30;
}

/* ==========================================
   MEDIA PRINT - SEMBUNYIKAN ELEMEN TIDAK PERLU
   ========================================== */
@media print {
    .no-print,
    nav,
    footer,
    #portal-help-chat-widget,
    #banner-mobile-pc-recommendation,
    #loading,
    .modal,
    button,
    .btn,
    #card-form-home-tasmik {
        display: none !important;
    }

    body {
        background: white !important;
        background-image: none !important;
        font-size: 12px;
    }

    .glass-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }

    table {
        box-shadow: none !important;
    }

    #screen-main {
        display: block !important;
    }
}

/* ==========================================
   TOAST NOTIFICATION ANIMATION
   ========================================== */
#qtrack-portal-toast {
    transition: opacity 0.4s ease !important;
}

/* ==========================================
   FULLSCREEN STYLING FOR QURAN & IQRA MODALS
   ========================================== */
#modal-quran:fullscreen,
#modal-quran-portal:fullscreen,
#modal-iqra:fullscreen,
#modal-iqra-portal:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    background-color: #f0f9ff !important;
    overflow: hidden !important;
}

#modal-quran:fullscreen .glass-card,
#modal-quran-portal:fullscreen .glass-card,
#modal-iqra:fullscreen .glass-card,
#modal-iqra-portal:fullscreen .glass-card,
#modal-quran .glass-card:fullscreen,
#modal-quran-portal .glass-card:fullscreen,
#modal-iqra .glass-card:fullscreen,
#modal-iqra-portal .glass-card:fullscreen {
    max-width: 100vw !important;
    width: 100vw !important;
    max-height: 100vh !important;
    height: 100vh !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background-color: #ffffff !important;
    margin: 0 !important;
    padding: 12px !important;
}

/* Fullscreen Dark Mode */
body.dark-mode #modal-quran:fullscreen,
body.dark-mode #modal-quran-portal:fullscreen,
body.dark-mode #modal-iqra:fullscreen,
body.dark-mode #modal-iqra-portal:fullscreen,
body.dark-mode #modal-quran .glass-card:fullscreen,
body.dark-mode #modal-quran-portal .glass-card:fullscreen,
body.dark-mode #modal-iqra .glass-card:fullscreen,
body.dark-mode #modal-iqra-portal .glass-card:fullscreen {
    background-color: #1e293b !important;
}

/* ==========================================
   PENUNJUK MENGAJI / IQRA POINTING FINGER CURSOR
   ========================================== */
.iqra-pointer-cursor,
.iqra-pointer-cursor canvas,
.iqra-pointer-cursor img {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Cfilter id='shadow' x='-10%25' y='-10%25' width='130%25' height='130%25'%3E%3CfeDropShadow dx='1' dy='2' stdDeviation='1.2' flood-color='%23000000' flood-opacity='0.4'/%3E%3C/filter%3E%3Cg filter='url(%23shadow)' transform='rotate(-15 14 14)'%3E%3Cpath d='M12,2 C13.3,2 14.3,3 14.3,4.5 L14.3,13.5 C15.1,12.8 16,12.5 17,12.8 C18,13.1 18.6,14 18.6,15 L18.6,15.5 C19.3,14.8 20.3,14.6 21.3,15 C22.2,15.4 22.8,16.3 22.8,17.3 L22.8,18 C23.4,17.5 24.4,17.4 25.2,17.9 C26.1,18.4 26.6,19.4 26.6,20.5 L26.6,23 C26.6,27.5 22.8,31 18,31 L14.5,31 C10.5,31 7,27.5 7,23.5 L7,16.5 C7,15.1 8.1,14 9.5,14 C10.9,14 12,15.1 12,16.5 L12,4.5 C12,3 13,2 14,2 Z' fill='%23fcd34d' stroke='%2378350f' stroke-width='1.8' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M7,24 L26.6,24 L26.6,31 L7,31 Z' fill='%23059669' stroke='%23064e3b' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E") 6 2, pointer !important;
}

/* ==========================================
   AUTO-CROP & FOCUS VERSE MODAL (CADANGAN 2)
   ========================================== */
.focus-crop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.focus-crop-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.focus-crop-card {
    background: #ffffff;
    border: 3px solid #059669;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(16, 185, 129, 0.35);
    max-width: 96%;
    max-height: 85%;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px;
    position: relative;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.focus-crop-overlay.active .focus-crop-card {
    transform: scale(1);
}

.focus-crop-img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 1px solid #e5e7eb;
}

/* ==========================================
   FLOATING FEEDBACK BUTTON & MODAL (PORTAL)
   ========================================== */
.floating-feedback-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 50;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 9999px;
    font-weight: 800;
    font-size: 12px;
    box-shadow: 0 10px 25px rgba(5, 150, 105, 0.4), 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 2px solid #34d399;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-feedback-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 14px 30px rgba(5, 150, 105, 0.5);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.star-rating-btn {
    font-size: 26px;
    color: #d1d5db;
    cursor: pointer;
    transition: transform 0.15s ease, color 0.15s ease;
}

.star-rating-btn:hover,
.star-rating-btn.active {
    color: #fbbf24;
    transform: scale(1.15);
}
