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

body {
    font-family: 'Tajawal', sans-serif;
    background-color: #f3f4f6;
    /* Gray 100 */
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    width: 100%;
    max-width: 100vw;
}

/* Prevent any child from causing horizontal scroll */
#app, #app > *, .fixed {
    max-width: 100vw;
}

/* Modal content safety */
.fixed > div {
    max-width: calc(100vw - 2rem);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fix for status bar overlap on mobile */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    /* Ensure header stays on top */
    padding-top: env(safe-area-inset-top, 25px) !important;
    /* Safe area + breathing room */
    height: auto;
    background-color: #1e3a5f;
    /* Make sure background is solid blue-800 to cover scrolling content */
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Islamic Pattern Overlay */
.bg-pattern {
    background-color: #f0f9ff;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%230369a1' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.dark .bg-pattern {
    background-color: #111827;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2360a5fa' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Utility */
.pb-safe {
    padding-bottom: env(safe-area-inset-bottom);
}

.glass-panel {
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.dark .glass-panel {
    background: rgba(31, 41, 55, 0.9);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Hide Scrollbar */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Global input dark mode fixes to prevent invisible text */
.dark input, .dark select, .dark textarea {
    color: #f3f4f6 !important;
    background-color: #374151 !important;
    border-color: #4b5563 !important;
}
.dark option {
    background-color: #1f2937 !important;
    color: #f3f4f6 !important;
}

/* Mobile Responsiveness for Modals */
@media (max-width: 640px) {
    .fixed > div {
        max-height: 85vh;
        width: min(380px, calc(100% - 2.5rem)) !important;
        margin: auto;
        border-radius: 2.5rem;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }
    
    .custom-scrollbar::-webkit-scrollbar {
        width: 4px;
    }
    .custom-scrollbar::-webkit-scrollbar-track {
        background: transparent;
    }
    .custom-scrollbar::-webkit-scrollbar-thumb {
        background: rgba(30, 58, 95, 0.2);
        border-radius: 10px;
    }
    
    .grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
    
    /* Ensure inputs don't zoom on focus in iOS */
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Specific modal scroll handle */
#competition-modal form {
    overflow-x: hidden;
    padding-bottom: 2rem;
}