/*
 * Century Rayon School - Enhanced Home Page Responsive CSS
 * Version: 2.0
 * Description: Mobile-first responsive design with cross-platform compatibility
 */

/* ==========================================
   RESPONSIVE DESIGN SYSTEM
   ========================================== */

:root {
    /* Breakpoints */
    --breakpoint-mobile: 320px;
    --breakpoint-mobile-lg: 480px;
    --breakpoint-tablet: 768px;
    --breakpoint-desktop: 1025px;
    --breakpoint-wide: 1441px;

    /* Container widths */
    --container-mobile: 100%;
    --container-tablet: 720px;
    --container-desktop: 1140px;
    --container-wide: 1400px;
}

/* ==========================================
   MOBILE-FIRST BASE STYLES
   ========================================== */

/* Mobile: 320px - 767px */
/* Mobile: 320px - 767px */
html {
    font-size: 17px;
    /* Increased from 16px for better visibility */
    overflow-x: hidden;
    overflow-y: auto;
    height: 100%;
}

body {
    font-size: 1rem;
    line-height: 1.7;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100%;
}

.container,
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

/* ==========================================
   RESPONSIVE HERO CAROUSEL
   ========================================== */

/* Mobile */
#heroCarousel .carousel-item img {
    height: 400px !important;
    object-fit: cover;
}

/* Tablet */
@media (min-width: 768px) {
    #heroCarousel .carousel-item img {
        height: 500px !important;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    #heroCarousel .carousel-item img {
        height: 630px !important;
    }
}

/* ==========================================
  /* Global Spacing and Layout Overrides */
html,
body {
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100%;
    margin: 0;
    padding: 0;
}

/* Ensure Header doesn't add space */
.modern-header {
    margin-bottom: 0 !important;
}

/* Banner Container Fix */
.tp-banner-container {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Adjust Section Padding globally */
.section-wrapper,
.section-modern {
    padding: 3rem 0;
}

/* Mobile Devices */
.section-wrapper {
    padding: 2rem 0 !important;
}

/* Tablet */
@media (min-width: 768px) {
    .section-wrapper {
        padding: 3rem 0 !important;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .section-wrapper {
        padding: 3rem 0 !important;
        /* Reduced from 4rem */
    }
}

/* No Padding Utility - Forcefully remove padding */
.section-wrapper.no-padding,
.section-modern.no-padding,
.no-padding {
    padding: 0 !important;
    margin: 0 !important;
}

/* ==========================================
   RESPONSIVE TYPOGRAPHY
   ========================================== */

/* Mobile */
.section-title h2 {
    font-size: 1.75rem !important;
}

.section-title p {
    font-size: 0.95rem !important;
}

h1 {
    font-size: 1.75rem !important;
}

h3 {
    font-size: 1.25rem !important;
}

h5 {
    font-size: 1.1rem !important;
}

p,
li {
    font-size: 0.95rem !important;
    line-height: 1.7 !important;
}

/* Tablet */
@media (min-width: 768px) {
    .section-title h2 {
        font-size: 2rem !important;
    }

    .section-title p {
        font-size: 1.05rem !important;
    }

    h1 {
        font-size: 2.25rem !important;
    }

    h3 {
        font-size: 1.5rem !important;
    }

    h5 {
        font-size: 1.2rem !important;
    }

    p,
    li {
        font-size: 1rem !important;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    html {
        font-size: 18px;
        /* Increased visibility for desktop */
    }

    .section-title h2 {
        font-size: 2.5rem !important;
    }

    .section-title p {
        font-size: 1.1rem !important;
    }

    h1 {
        font-size: 2.75rem !important;
    }

    h3 {
        font-size: 1.625rem !important;
    }

    p,
    li {
        font-size: 1.125rem !important;
    }
}

/* ==========================================
   RESPONSIVE CARDS - ANNOUNCEMENTS/EVENTS
   ========================================== */

/* Mobile - Stack all cards */
.row.g-4 {
    row-gap: 1.5rem !important;
}

/* Tablet - 2 columns for better space usage */
@media (min-width: 768px) and (max-width: 1024px) {

    .announcement-card,
    .event-card,
    .notice-card {
        flex: 0 0 calc(50% - 1rem);
        max-width: calc(50% - 1rem);
    }
}

/* ==========================================
   RESPONSIVE ADMISSION MODAL
   ========================================== */

/* Mobile */
.modal-dialog {
    margin: 0.5rem !important;
    max-width: calc(100% - 1rem) !important;
}

.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

.modal-body {
    padding: 1rem !important;
}

/* Tablet */
@media (min-width: 768px) {
    .modal-dialog {
        margin: 1.75rem auto !important;
        max-width: 600px !important;
    }

    .modal-body {
        padding: 1.5rem !important;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .modal-dialog {
        max-width: 650px !important;
    }
}

/* ==========================================
   RESPONSIVE SOCIAL FLOAT ICONS
   ========================================== */

/* Mobile - Hide floating icons, show in footer instead */
@media (max-width: 767px) {
    .social-float {
        display: none !important;
    }

    /* Add footer social icons for mobile */
    .mobile-social-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(124, 56, 72, 0.95);
        backdrop-filter: blur(10px);
        padding: 10px;
        display: flex;
        justify-content: center;
        gap: 15px;
        z-index: 9998;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    }

    .mobile-social-footer a {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        color: #fff;
        font-size: 18px;
        text-decoration: none;
        transition: transform 0.3s ease;
    }

    .mobile-social-footer a:active {
        transform: scale(0.95);
    }
}

/* Tablet - Smaller floating icons, bottom-right */
@media (min-width: 768px) and (max-width: 1024px) {
    .social-float {
        right: 10px !important;
        gap: 10px !important;
    }

    .social-float a {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
}

/* Desktop - Standard floating icons */
@media (min-width: 1025px) {
    .social-float a {
        width: 42px;
        height: 42px;
    }
}

/* ==========================================
   RESPONSIVE GALLERY
   ========================================== */

/* Mobile - 1 image per slide */
@media (max-width: 767px) {
    #carouselGallery .d-flex {
        flex-direction: column !important;
    }

    #carouselGallery .w-50 {
        width: 100% !important;
    }

    #carouselGallery img {
        height: 300px !important;
    }
}

/* Tablet - 2 images per slide */
@media (min-width: 768px) and (max-width: 1024px) {
    #carouselGallery img {
        height: 350px !important;
    }
}

/* ==========================================
   TOUCH-FRIENDLY BUTTON SIZES
   ========================================== */

/* Ensure minimum touch target size of 44px */
.btn,
button,
.carousel-control-prev,
.carousel-control-next,
.btn-close {
    min-height: 44px;
    min-width: 44px;
}

/* ==========================================
   RESPONSIVE FORM INPUTS
   ========================================== */

.form-field,
.form-control {
    font-size: 16px !important;
    /* Prevents iOS zoom on focus */
    padding: 12px 14px !important;
}

@media (min-width: 768px) {

    .form-field,
    .form-control {
        font-size: 15px !important;
        padding: 10px 12px !important;
    }
}

/* ==========================================
   CONTAINER MAX-WIDTH FOR ULTRA-WIDE
   ========================================== */

@media (min-width: 1441px) {

    .container,
    .container-fluid {
        max-width: 1400px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ==========================================
   ENHANCED CARD HOVER EFFECTS
   ========================================== */

.announcement-card,
.event-card,
.notice-card {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Glassmorphism effect */
.announcement-card::before,
.event-card::before,
.notice-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 15px;
    pointer-events: none;
}

.announcement-card:hover::before,
.event-card:hover::before,
.notice-card:hover::before {
    opacity: 1;
}

/* Desktop hover effects */
@media (min-width: 1025px) {

    .announcement-card:hover,
    .event-card:hover,
    .notice-card:hover {
        transform: translateY(-10px) scale(1.02);
        box-shadow: 0 20px 40px rgba(124, 56, 72, 0.3) !important;
    }
}

/* Tablet hover effects */
@media (min-width: 768px) and (max-width: 1024px) {

    .announcement-card:hover,
    .event-card:hover,
    .notice-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 15px 30px rgba(124, 56, 72, 0.2) !important;
    }
}

/* Mobile - No transform on tap, just visual feedback */
@media (max-width: 767px) {

    .announcement-card:active,
    .event-card:active,
    .notice-card:active {
        opacity: 0.9;
    }
}

/* ==========================================
   IMPROVED SCROLL PERFORMANCE
   ========================================== */

.announcement-card,
.event-card,
.notice-card,
#heroCarousel,
#carouselGallery {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ==========================================
   REDUCED MOTION SUPPORT
   ========================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================
   IMPROVED CAROUSEL CONTROLS FOR MOBILE
   ========================================== */

@media (max-width: 767px) {

    .carousel-control-prev,
    .carousel-control-next {
        width: 44px !important;
        height: 44px !important;
        margin: 0 5px !important;
        opacity: 0.8 !important;
    }

    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 24px !important;
        height: 24px !important;
    }
}

/* ==========================================
   SCROLLING CONTENT IMPROVEMENTS
   ========================================== */

.scrolling-content {
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
}

/* ==========================================
   SAFE AREA INSETS FOR MOBILE DEVICES
   ========================================== */

@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-social-footer {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

/* ==========================================
   LANDSCAPE MODE ADJUSTMENTS
   ========================================== */

@media (max-width: 767px) and (orientation: landscape) {
    #heroCarousel .carousel-item img {
        height: 300px !important;
    }

    .section-wrapper {
        padding: 1.5rem 0 !important;
    }
}

/* ==========================================
   EVENT DATE BADGE RESPONSIVENESS
   ========================================== */

.event-card .card-header {
    padding: 1rem 0 !important;
}

.event-card .card-header .fw-bold {
    font-size: 1.5rem !important;
}

@media (min-width: 768px) {
    .event-card .card-header .fw-bold {
        font-size: 2rem !important;
    }
}

/* ==========================================
   NOTICE CARD IMAGE HEIGHTS
   ========================================== */

.notice-card img {
    height: 200px !important;
    object-fit: cover !important;
}

@media (min-width: 768px) {
    .notice-card img {
        height: 250px !important;
    }
}

@media (min-width: 1025px) {
    .notice-card img {
        height: 300px !important;
    }
}

/* ==========================================
   IMPROVED MODAL TRANSITIONS
   ========================================== */

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.modal.show .modal-dialog {
    transform: none;
}

/* ==========================================
   CROSS-BROWSER COMPATIBILITY
   ========================================== */

/* Flexbox fallbacks */
.d-flex {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

/* Grid fallbacks */
/* Removed dangerous .row grid override that breaks Bootstrap */

/* Backdrop-filter fallbacks for older browsers */
@supports not (backdrop-filter: blur(10px)) {

    .announcement-card,
    .event-card,
    .notice-card {
        background-color: rgba(124, 56, 72, 0.95) !important;
    }
}

/* ==========================================
   SMOOTH SCROLL BEHAVIOR
   ========================================== */

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* ==========================================
   FOOTER ADJUSTMENTS FOR MOBILE SOCIAL BAR
   ========================================== */

@media (max-width: 767px) {
    body {
        padding-bottom: 100px !important;
        /* Increased space for fixed social bar and mobile nav */
    }
}

/* ==========================================
   UTILITY OVERRIDES
   ========================================== */
.section-wrapper.no-padding {
    padding: 0 !important;
}