/* Custom Styles for Oasis IMG */

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-in;
}

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

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

::-webkit-scrollbar-thumb {
    background: #2563eb;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1e40af;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Form Focus States */
input:focus, textarea:focus, select:focus {
    outline: none;
    ring: 2px;
    ring-color: #2563eb;
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Breadcrumb Styling */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-item:not(:last-child)::after {
    content: '/';
    margin-left: 0.5rem;
    color: #9ca3af;
}

/* Custom Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Stats Counter Animation */
.stat-number {
    font-variant-numeric: tabular-nums;
}

/* Image Overlay Effects */
.image-overlay {
    position: relative;
    overflow: hidden;
}

.image-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease;
}

.image-overlay:hover::after {
    background: rgba(0, 0, 0, 0.5);
}

/* Ministry Card Grid */
.ministry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* Leadership Card */
.leader-card {
    transition: all 0.3s ease;
}

.leader-card:hover {
    transform: scale(1.05);
}

/* Timeline Styles */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #2563eb;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.5rem;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2563eb;
    border: 3px solid white;
    box-shadow: 0 0 0 3px #2563eb;
}

/* Responsive Video Container */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Print Styles */
@media print {
    .no-print {
        display: none;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible for Keyboard Navigation */
*:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
    animation: fadeInUp 0.3s ease-out;
}

/* Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f4f6;
    border-top: 5px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    cursor: pointer;
    aspect-ratio: 1 / 1;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: #2563eb;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #1e40af;
    transform: translateY(-5px);
}

/* Responsive Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background: #f9fafb;
    font-weight: 600;
}

/* Custom Checkbox and Radio */
.custom-checkbox,
.custom-radio {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-radio {
    border-radius: 50%;
}

.custom-checkbox:checked,
.custom-radio:checked {
    background: #2563eb;
    border-color: #2563eb;
}

/* Mobile Responsive Utilities */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none;
    }

    .mobile-full-width {
        width: 100%;
    }
}

/* Print Utilities */
@media print {
    .print-hidden {
        display: none;
    }

    .print-break {
        page-break-after: always;
    }
}

/* =====================================================
   GLOBAL OVERFLOW PREVENTION
   ===================================================== */

/* Prevent any element from causing horizontal scroll */
img,
video,
iframe,
embed,
object,
svg {
    max-width: 100%;
}

/* Ensure box-sizing is consistent */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Prevent text from overflowing containers */
body {
    overflow-x: hidden;
}

/* =====================================================
   MOBILE RESPONSIVE OVERRIDES — Tablet (< 1024px)
   ===================================================== */
@media (max-width: 1023px) {
    /* Reduce nav height slightly */
    nav .h-20 {
        height: 4.5rem;
    }
}

/* =====================================================
   MOBILE RESPONSIVE OVERRIDES — Mobile (< 768px)
   ===================================================== */
@media (max-width: 767px) {

    /* ---------- Hero Carousel ---------- */
    #carousel {
        height: 400px !important;
    }

    .carousel-slide h1 {
        font-size: 1.75rem !important;   /* ~text-2xl */
        line-height: 2.1rem !important;
        margin-bottom: 0.75rem !important;
    }

    .carousel-slide p {
        font-size: 0.95rem !important;
        line-height: 1.4rem !important;
        margin-bottom: 1.25rem !important;
    }

    .carousel-slide a {
        padding: 0.6rem 1.5rem !important;
        font-size: 0.875rem !important;
    }

    /* Carousel prev/next buttons */
    #prev-slide,
    #next-slide {
        padding: 0.5rem !important;
    }

    /* ---------- Section Spacing ---------- */
    /* Reduce heavy py-20 (5rem each side) on mobile */
    section.py-20 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    section.py-16 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    /* ---------- Section Headings ---------- */
    section h2.text-4xl {
        font-size: 1.875rem !important;
        line-height: 2.25rem !important;
    }

    section h3.text-2xl {
        font-size: 1.25rem !important;
    }

    /* ---------- About / Content Images ---------- */
    /* Any img without an explicit height class fills full width */
    section img:not([class*="h-"]):not([class*="logo"]) {
        width: 100%;
        height: auto;
    }

    /* ---------- Stats Section ---------- */
    /* Already grid-cols-2, but shrink large numbers */
    [data-count] {
        font-size: 2rem !important;
        line-height: 2.5rem !important;
    }

    /* ---------- Map / iFrame Container ---------- */
    .h-96 {
        height: 220px !important;
    }

    /* ---------- Footer ---------- */
    footer .grid {
        gap: 1.5rem;
    }

    /* ---------- Ministry Grid (dynamic cards) ---------- */
    #ministries-preview,
    #events-preview,
    #news-preview {
        grid-template-columns: 1fr !important;
    }

    /* ---------- Leadership Preview ---------- */
    #leadership-preview {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ---------- Card Images (ministry, event, news) ---------- */
    #ministries-preview img,
    #events-preview img,
    #news-preview img {
        height: 180px !important;
    }

    /* ---------- CTA Buttons ---------- */
    .flex.flex-col.sm\:flex-row,
    .flex-col {
        gap: 0.75rem;
    }

    /* ---------- Contact / Map Section ---------- */
    .grid.md\:grid-cols-2 > div {
        min-width: 0;
    }

    /* ---------- Admissions Modal ---------- */
    #admissions-modal .max-w-md {
        max-width: 92vw;
    }

    #admissions-modal .p-8 {
        padding: 1.5rem;
    }

    /* ---------- Back to Top button placement ---------- */
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}

/* =====================================================
   MOBILE RESPONSIVE OVERRIDES — Small Phones (< 480px)
   ===================================================== */
@media (max-width: 479px) {

    /* Hero carousel even shorter on very small phones */
    #carousel {
        height: 320px !important;
    }

    .carousel-slide h1 {
        font-size: 1.35rem !important;
        line-height: 1.75rem !important;
    }

    .carousel-slide p {
        font-size: 0.85rem !important;
    }

    /* Nav logo text */
    nav .text-xl {
        font-size: 1rem;
    }

    /* Stats — keep 2-col but smaller text */
    [data-count] {
        font-size: 1.75rem !important;
    }

    /* Ministries / Events / News section headings */
    section h2 {
        font-size: 1.5rem !important;
        line-height: 2rem !important;
    }

    /* Leadership — 1 col on tiny screens */
    #leadership-preview {
        grid-template-columns: 1fr !important;
    }

    /* About section grid gap */
    .gap-12 {
        gap: 2rem !important;
    }

    /* Admissions modal content */
    #admissions-modal .text-3xl {
        font-size: 1.4rem !important;
    }
}