/* ========================================
   EK FOUNDATION - RESPONSIVE CSS
   ========================================
   Author: EK Foundation
   Description: Responsive styles for all devices
   Version: 1.0.0
   ======================================== */

/* ========================================
   TABLE OF CONTENTS
   ========================================
   1. Mobile First Base Styles
   2. Small Devices (Phones - 576px and below)
   3. Medium Devices (Tablets - 768px to 991px)
   4. Large Devices (Desktops - 992px to 1199px)
   5. Extra Large Devices (1200px and above)
   6. Landscape Orientation
   7. Print Styles
   8. Accessibility (Reduced Motion)
   9. High Resolution Displays
   10. Dark Mode Support (Optional)
   ======================================== */

/* ========================================
   1. MOBILE FIRST BASE STYLES (Default)
   ======================================== */
/* These styles apply to all devices first, then overridden by larger breakpoints */

.container {
    width: 100%;
    padding: 0 20px;
    margin: 0 auto;
}

/* Typography - Mobile First */
body {
    font-size: 15px;
    line-height: 1.6;
}

h1 { font-size: 2rem; line-height: 1.2; }
h2 { font-size: 1.75rem; line-height: 1.2; }
h3 { font-size: 1.5rem; line-height: 1.2; }
h4 { font-size: 1.25rem; line-height: 1.3; }
h5 { font-size: 1.125rem; line-height: 1.4; }
h6 { font-size: 1rem; line-height: 1.4; }

.section-title {
    margin-bottom: 2rem;
}

.section-title h2 {
    font-size: 1.75rem;
}

.section-title p {
    font-size: 0.875rem;
}

/* Spacing - Mobile First */
section {
    padding: 3rem 0;
}

/* Buttons - Mobile First */
.btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
}

/* Grids - Mobile First */
.stats-grid,
.programs-grid,
.news-grid,
.team-grid,
.portfolio-grid,
.footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
}

/* Hero Section - Mobile First */
.hero {
    min-height: 80vh;
    margin-top: 70px;
}

.hero-title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.hero-buttons {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.hero-buttons .btn {
    width: 100%;
    max-width: 220px;
}

/* Stats Section - Mobile First */
.stats-section {
    padding: 2rem 0;
    margin-top: -40px;
}

.stat-card {
    padding: 1.25rem;
}

.stat-icon {
    width: 55px;
    height: 55px;
}

.stat-icon i {
    font-size: 1.5rem;
}

.stat-number {
    font-size: 1.75rem;
}

.stat-label {
    font-size: 0.75rem;
}

/* Event Cards - Mobile First */
.event-card {
    flex-direction: column;
}

.event-date {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    min-width: auto;
}

.event-date .day {
    font-size: 1.5rem;
}

.event-date .month {
    font-size: 0.75rem;
}

.event-details {
    padding: 1rem;
}

.event-title {
    font-size: 1.125rem;
}

/* News Cards - Mobile First */
.news-image {
    height: 200px;
}

.news-content {
    padding: 1rem;
}

.news-title {
    font-size: 1rem;
}

/* Portfolio Items - Mobile First */
.portfolio-item {
    aspect-ratio: 4/3;
}

.portfolio-overlay {
    padding: 1rem;
}

/* Team Cards - Mobile First */
.team-image {
    aspect-ratio: 1;
}

.team-info {
    padding: 1rem;
}

.team-name {
    font-size: 1rem;
}

/* Testimonials - Mobile First */
.testimonial-card {
    padding: 1rem;
}

.testimonial-content p {
    font-size: 0.875rem;
}

.testimonial-author img {
    width: 50px;
    height: 50px;
}

/* Footer - Mobile First */
.footer {
    padding: 2rem 0 1rem;
}

.footer-grid {
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.footer h4 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

/* Newsletter - Mobile First */
.newsletter-form {
    flex-direction: column;
}

.newsletter-form input {
    width: 100%;
    text-align: center;
}

.newsletter-form button {
    width: 100%;
}

/* Navbar - Mobile First */
.navbar .container {
    padding: 0.75rem 1rem;
}

.navbar-brand img {
    height: 40px;
}

.navbar-menu {
    position: fixed;
    top: 70px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background: white;
    flex-direction: column;
    padding: 2rem;
    transition: left 0.3s ease;
    z-index: 999;
}

.navbar-menu.active {
    left: 0;
}

.navbar-menu a {
    padding: 0.75rem 0;
    width: 100%;
    text-align: center;
}

.navbar-toggle {
    display: block;
}

/* ========================================
   2. SMALL DEVICES (Phones - 576px and above)
   ======================================== */
@media (min-width: 576px) {
    /* Typography */
    h1 { font-size: 2.25rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.75rem; }
    
    .section-title h2 {
        font-size: 2rem;
    }
    
    /* Hero Section */
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .hero-buttons {
        flex-direction: row;
        justify-content: center;
    }
    
    .hero-buttons .btn {
        width: auto;
    }
    
    /* Grids */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .programs-grid,
    .news-grid,
    .team-grid,
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Footer Grid */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Newsletter Form */
    .newsletter-form {
        flex-direction: row;
    }
    
    .newsletter-form input {
        text-align: left;
    }
    
    .newsletter-form button {
        width: auto;
    }
}

/* ========================================
   3. MEDIUM DEVICES (Tablets - 768px and above)
   ======================================== */
@media (min-width: 768px) {
    /* Typography */
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2.25rem; }
    h3 { font-size: 2rem; }
    
    body {
        font-size: 16px;
    }
    
    .section-title h2 {
        font-size: 2.25rem;
    }
    
    .section-title p {
        font-size: 1rem;
    }
    
    /* Spacing */
    section {
        padding: 4rem 0;
    }
    
    .container {
        padding: 0 30px;
    }
    
    /* Hero Section */
    .hero {
        min-height: 90vh;
        margin-top: 80px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    /* Stats Section */
    .stats-section {
        padding: 3rem 0;
        margin-top: -50px;
    }
    
    .stat-icon {
        width: 70px;
        height: 70px;
    }
    
    .stat-icon i {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    /* About Grid */
    .about-grid {
        gap: 3rem;
    }
    
    /* Event Cards */
    .event-card {
        flex-direction: row;
    }
    
    .event-date {
        flex-direction: column;
        min-width: 100px;
        padding: 1.25rem;
    }
    
    .event-date .day {
        font-size: 2rem;
    }
    
    /* Footer Grid */
    .footer-grid {
        gap: 2rem;
    }
    
    /* Navbar */
    .navbar-brand img {
        height: 50px;
    }
}

/* ========================================
   4. LARGE DEVICES (Desktops - 992px and above)
   ======================================== */
@media (min-width: 992px) {
    /* Typography */
    h1 { font-size: 3rem; }
    h2 { font-size: 2.5rem; }
    h3 { font-size: 2rem; }
    
    .section-title h2 {
        font-size: 2.5rem;
    }
    
    /* Spacing */
    section {
        padding: 5rem 0;
    }
    
    .container {
        max-width: 960px;
        padding: 0;
    }
    
    /* Grids */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
    
    .programs-grid,
    .news-grid,
    .team-grid,
    .portfolio-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.75rem;
    }
    
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    /* About Grid */
    .about-grid {
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
    }
    
    /* Hero Section */
    .hero-title {
        font-size: 3rem;
    }
    
    /* Navbar - Desktop */
    .navbar-menu {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        flex-direction: row;
        padding: 0;
        gap: 2rem;
    }
    
    .navbar-menu a {
        width: auto;
        padding: 0;
    }
    
    .navbar-toggle {
        display: none;
    }
    
    /* Stats Section */
    .stats-section {
        margin-top: -60px;
    }
}

/* ========================================
   5. EXTRA LARGE DEVICES (1200px and above)
   ======================================== */
@media (min-width: 1200px) {
    /* Typography */
    h1 { font-size: 3.5rem; }
    h2 { font-size: 3rem; }
    h3 { font-size: 2.25rem; }
    
    .container {
        max-width: 1140px;
    }
    
    /* Grids */
    .programs-grid,
    .news-grid,
    .team-grid,
    .portfolio-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    /* Hero Section */
    .hero-title {
        font-size: 3.5rem;
    }
    
    /* Spacing */
    section {
        padding: 6rem 0;
    }
}

/* ========================================
   6. LANDSCAPE ORIENTATION (Mobile Landscape)
   ======================================== */
@media (max-width: 768px) and (orientation: landscape) {
    /* Hero Section */
    .hero {
        min-height: auto;
        padding: 4rem 0;
    }
    
    /* Stats Section */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Program Cards */
    .programs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Navbar */
    .navbar-menu {
        overflow-y: auto;
        height: calc(100vh - 70px);
    }
}

/* ========================================
   7. PRINT STYLES
   ======================================== */
@media print {
    /* Hide non-printable elements */
    .navbar,
    .footer,
    .newsletter-section,
    .cta-section,
    .hero-buttons,
    .btn,
    .navbar-toggle,
    .footer-social,
    .trust-badges,
    .pagination,
    .breadcrumb {
        display: none !important;
    }
    
    /* Printable styles */
    body {
        background: white;
        color: black;
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .hero {
        min-height: auto;
        padding: 1rem 0;
        margin-top: 0;
    }
    
    .hero::before {
        display: none;
    }
    
    .hero-content {
        color: black;
    }
    
    .hero-title {
        font-size: 24pt;
        color: black;
    }
    
    .hero-subtitle {
        font-size: 14pt;
        color: #333;
    }
    
    .stats-section,
    .about-section,
    .programs-section,
    .events-section,
    .news-section,
    .portfolio-section,
    .team-section,
    .testimonials-section {
        padding: 1rem 0;
        page-break-inside: avoid;
    }
    
    .stat-card,
    .program-card,
    .event-card,
    .news-card,
    .team-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }
    
    a {
        text-decoration: none;
        color: black;
    }
    
    .footer {
        background: none;
        color: black;
        padding: 1rem 0;
    }
    
    .footer h4 {
        color: black;
    }
    
    .footer h4::after {
        background: #333;
    }
    
    .footer-links ul li a,
    .footer-contact p,
    .footer-about p {
        color: #333;
    }
}

/* ========================================
   8. ACCESSIBILITY (Reduced Motion)
   ======================================== */
@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;
    }
    
    .stat-card:hover,
    .program-card:hover,
    .news-card:hover,
    .team-card:hover,
    .portfolio-item:hover img {
        transform: none !important;
    }
}

/* ========================================
   9. HIGH RESOLUTION DISPLAYS (Retina)
   ======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero {
        background-attachment: scroll;
    }
    
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ========================================
   10. DARK MODE SUPPORT (Optional)
   ======================================== */
@media (prefers-color-scheme: dark) {
    body.dark-mode {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    body.dark-mode .navbar,
    body.dark-mode .navbar-menu {
        background: #2d2d2d;
    }
    
    body.dark-mode .navbar-menu a {
        color: #e0e0e0;
    }
    
    body.dark-mode .card,
    body.dark-mode .stat-card,
    body.dark-mode .program-card,
    body.dark-mode .event-card,
    body.dark-mode .news-card,
    body.dark-mode .team-card,
    body.dark-mode .testimonial-card {
        background: #2d2d2d;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    
    body.dark-mode .about-section,
    body.dark-mode .events-section,
    body.dark-mode .portfolio-section,
    body.dark-mode .testimonials-section {
        background: #222;
    }
    
    body.dark-mode .footer {
        background: #111;
    }
}

/* ========================================
   UTILITY CLASSES FOR RESPONSIVE HIDING
   ======================================== */
/* Hide on mobile */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show on mobile only */
@media (min-width: 768px) {
    .show-mobile {
        display: none !important;
    }
}

/* Hide on tablet */
@media (min-width: 768px) and (max-width: 991px) {
    .hide-tablet {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 992px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Text alignment responsive */
@media (max-width: 767px) {
    .text-center-mobile {
        text-align: center !important;
    }
    
    .text-left-mobile {
        text-align: left !important;
    }
    
    .text-right-mobile {
        text-align: right !important;
    }
}

/* Flex direction responsive */
@media (max-width: 767px) {
    .flex-column-mobile {
        flex-direction: column !important;
    }
    
    .flex-wrap-mobile {
        flex-wrap: wrap !important;
    }
    
    .gap-mobile {
        gap: 0.5rem !important;
    }
}

/* Margin/Padding responsive utilities */
@media (max-width: 767px) {
    .mt-mobile-0 { margin-top: 0 !important; }
    .mt-mobile-1 { margin-top: 0.5rem !important; }
    .mt-mobile-2 { margin-top: 1rem !important; }
    .mt-mobile-3 { margin-top: 1.5rem !important; }
    
    .mb-mobile-0 { margin-bottom: 0 !important; }
    .mb-mobile-1 { margin-bottom: 0.5rem !important; }
    .mb-mobile-2 { margin-bottom: 1rem !important; }
    .mb-mobile-3 { margin-bottom: 1.5rem !important; }
    
    .pt-mobile-0 { padding-top: 0 !important; }
    .pt-mobile-1 { padding-top: 0.5rem !important; }
    .pt-mobile-2 { padding-top: 1rem !important; }
    .pt-mobile-3 { padding-top: 1.5rem !important; }
    
    .pb-mobile-0 { padding-bottom: 0 !important; }
    .pb-mobile-1 { padding-bottom: 0.5rem !important; }
    .pb-mobile-2 { padding-bottom: 1rem !important; }
    .pb-mobile-3 { padding-bottom: 1.5rem !important; }
}

/* Width responsive utilities */
@media (max-width: 767px) {
    .w-100-mobile {
        width: 100% !important;
    }
    
    .w-50-mobile {
        width: 50% !important;
    }
}

/* ========================================
   RESPONSIVE FONT SIZES
   ======================================== */
html {
    font-size: 14px;
}

@media (min-width: 576px) {
    html {
        font-size: 15px;
    }
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

@media (min-width: 992px) {
    html {
        font-size: 16px;
    }
}

@media (min-width: 1200px) {
    html {
        font-size: 17px;
    }
}

/* ========================================
   RESPONSIVE CONTAINER WIDTHS
   ======================================== */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
        margin: 0 auto;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* ========================================
   RESPONSIVE IMAGES
   ======================================== */
img {
    max-width: 100%;
    height: auto;
}

/* Responsive iframes (YouTube, Google Maps) */
iframe {
    max-width: 100%;
}

/* ========================================
   RESPONSIVE TABLES
   ======================================== */
@media (max-width: 767px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-responsive table {
        min-width: 600px;
    }
}

/* ========================================
   RESPONSIVE FORMS
   ======================================== */
@media (max-width: 767px) {
    input,
    select,
    textarea,
    button {
        font-size: 16px; /* Prevents zoom on focus in iOS */
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-row .form-group {
        width: 100%;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets for touch devices */
    .btn,
    .menu-item,
    .nav-link,
    .footer-links a,
    .pagination a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Remove hover effects on touch devices */
    .stat-card:hover,
    .program-card:hover,
    .news-card:hover,
    .team-card:hover {
        transform: none;
    }
}

/* ========================================
   NOTCH AND SAFE AREA SUPPORT (iPhone X and newer)
   ======================================== */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    
    .hero {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
}