/* ============================================
   منظمة العالم الإسلامي للشباب - Responsive Design System
   Professional Mobile-First CSS
   Supports: All devices from 320px to 2560px+
   ============================================ */

/* ================================================================================
   RESPONSIVE BREAKPOINTS:
   - Extra Small (xs): 0 - 480px (Small phones)
   - Small (sm): 481px - 640px (Large phones)
   - Medium (md): 641px - 768px (Tablets portrait)
   - Large (lg): 769px - 1024px (Tablets landscape, small laptops)
   - Extra Large (xl): 1025px - 1280px (Laptops, desktops)
   - 2X Large (2xl): 1281px+ (Large desktops, monitors)
   ================================================================================ */

/* ================================================================================
   BASE MOBILE FIXES
   ================================================================================ */

/* Prevent text size adjustment on orientation change */
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Smooth scrolling with reduced motion support */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Touch-friendly tap targets */
button,
a,
input,
select,
textarea {
    touch-action: manipulation;
}

/* Prevent iOS zoom on form inputs */
@media screen and (max-width: 768px) {

    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ================================================================================
   EXTRA LARGE SCREENS (2560px+)
   ================================================================================ */
@media (min-width: 2560px) {
    html {
        font-size: 20px;
    }

    .container {
        max-width: 1800px;
    }
}

/* ================================================================================
   LARGE DESKTOPS (1281px - 2559px)
   ================================================================================ */
@media (min-width: 1281px) and (max-width: 2559px) {
    html {
        font-size: 17px;
    }
}

/* ================================================================================
   LAPTOPS & SMALL DESKTOPS (1025px - 1280px)
   ================================================================================ */
@media (min-width: 1025px) and (max-width: 1280px) {
    .container {
        max-width: 1100px;
        padding: 0 2rem;
    }

    .hero__container {
        gap: 3rem;
    }

    .nav__menu {
        gap: 2rem;
    }
}

/* ================================================================================
   TABLETS LANDSCAPE & SMALL LAPTOPS (769px - 1024px)
   ================================================================================ */
@media (max-width: 1024px) {
    :root {
        --nav-height: 70px;
        --space-xl: 3rem;
        --space-2xl: 4rem;
        --space-3xl: 5rem;
        --space-4xl: 6rem;
    }

    .container {
        max-width: 100%;
        padding: 0 1.5rem;
    }

    /* News Hero - Tablet Landscape */
    .news-hero__nav {
        opacity: 1;
    }

    .news-hero__title {
        max-width: 100%;
    }

    .news-hero__content {
        padding: 0 2rem;
    }

    .news-hero__brand {
        right: 2rem;
    }

    /* Navigation */
    .nav__menu {
        position: fixed;
        top: var(--nav-height);
        right: -100%;
        width: 100%;
        height: calc(100vh - var(--nav-height));
        background: var(--bg-white);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: 3rem;
        gap: 0;
        transition: right 0.3s ease-in-out;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }

    .nav__menu.active {
        right: 0;
    }

    .nav__menu li {
        width: 100%;
        text-align: center;
    }

    .nav__link {
        display: block;
        padding: 1rem 2rem;
        font-size: 1.1rem;
        border-bottom: 1px solid var(--bg-neutral);
    }

    .nav__toggle {
        display: flex !important;
    }

    .nav__cta {
        display: none;
    }

    /* Grids */
    .grid[style*="repeat(3"],
    .grid[style*="repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Cards */
    .card__image {
        height: 220px;
    }

    /* Footer */
    .footer__grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem;
    }

    /* Section spacing */
    .section {
        padding: 4rem 0;
    }

    .section-header {
        margin-bottom: 3rem;
    }


}

/* ================================================================================
   TABLETS PORTRAIT (641px - 768px)
   ================================================================================ */
@media (max-width: 768px) {
    :root {
        --nav-height: 60px;
        --space-md: 1rem;
        --space-lg: 1.5rem;
        --space-xl: 2rem;
        --space-2xl: 2.5rem;
        --space-3xl: 3rem;
    }

    html {
        font-size: 15px;
    }

    .container {
        padding: 0 1rem;
    }

    /* Typography scaling */
    h1,
    .h1 {
        font-size: clamp(1.75rem, 6vw, 2.5rem) !important;
        line-height: 1.3;
    }

    h2,
    .h2 {
        font-size: clamp(1.5rem, 5vw, 2rem) !important;
        line-height: 1.35;
    }

    h3,
    .h3 {
        font-size: clamp(1.25rem, 4vw, 1.5rem) !important;
    }

    p {
        font-size: 0.9375rem;
        line-height: 1.8;
    }

    /* Hero */
    .hero {
        min-height: auto;
        padding-top: calc(var(--nav-height) + 2rem);
        padding-bottom: 3rem;
    }

    .hero__container {
        min-height: auto;
        padding: 0;
    }

    .hero__title {
        font-size: clamp(1.75rem, 7vw, 2.5rem) !important;
    }

    .hero__desc {
        font-size: 1rem;
    }

    .hero__label {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }

    .hero__actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero__actions .btn {
        width: 100%;
    }

    .hero__stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-top: 2rem;
    }

    .hero__visual,
    .hero__decoration {
        display: none !important;
    }

    /* Navigation */
    .nav__logo-img {
        height: 45px;
    }

    .nav__container {
        padding: 0 1rem;
    }

    /* Language Toggle - Mobile */
    .lang-toggle {
        padding: 6px 12px;
        font-size: 0.75rem;
        gap: 4px;
        border-color: rgba(17, 94, 69, 0.25) !important;
        background: rgba(17, 94, 69, 0.08) !important;
        color: var(--green-primary) !important;
    }

    .lang-toggle:hover {
        background: rgba(17, 94, 69, 0.15) !important;
        border-color: var(--green-primary) !important;
    }

    .lang-toggle__icon {
        width: 14px;
        height: 14px;
    }

    /* Media Center - White Background */
    .media-center {
        background: #fff !important;
    }

    /* Grids - single column */
    .grid,
    .grid[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns: 1fr 2fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Gap adjustments */
    [style*="gap: var(--space-3xl)"] {
        gap: 1.5rem !important;
    }

    [style*="gap: var(--space-2xl)"] {
        gap: 1.25rem !important;
    }

    [style*="gap: var(--space-xl)"] {
        gap: 1rem !important;
    }

    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.5rem;
    }

    .btn--large {
        padding: 1rem 2rem;
    }

    /* Cards */
    .card {
        border-radius: 16px;
    }

    .card__content {
        padding: 1.25rem;
    }

    .card__image {
        height: 180px;
    }

    /* Section Headers */
    .section {
        padding: 3rem 0;
    }

    .section-header {
        margin-bottom: 2rem;
    }

    .section-header__label {
        font-size: 0.75rem;
    }

    .section-header__label::before,
    .section-header__label::after {
        width: 20px;
    }

    /* Page Header */
    .page-header {
        padding: 2rem 0;
        padding-top: calc(var(--nav-height) + 1.5rem);
    }

    .page-header__title {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
    }

    /* Stats */
    .stat-item {
        padding: 1rem;
    }

    .stat-item__number {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.8rem;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    /* News */
    .news__grid {
        grid-template-columns: 1fr !important;
    }

    .news-featured {
        height: 250px;
    }

    .news-featured__title {
        font-size: 1.25rem;
    }

    .news-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .news-item__image {
        width: 80px;
        height: 60px;
    }

    /* News Hero Responsive - Tablet */
    .news-hero {
        height: 55vh;
        min-height: 380px;
    }

    .news-hero__content {
        padding: 0 var(--space-lg);
        padding-bottom: 60px;
    }

    .news-hero__title {
        font-size: 1.5rem !important;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .news-hero__badge {
        font-size: 0.75rem;
        padding: 5px 12px;
    }

    .news-hero__btn {
        padding: 10px 22px;
        font-size: 0.875rem;
    }

    .news-hero__nav {
        width: 42px;
        height: 42px;
        opacity: 1;
    }

    .news-hero__nav--prev {
        right: 12px;
    }

    .news-hero__nav--next {
        left: 12px;
    }

    .news-hero__brand {
        display: none;
    }

    .news-hero__controls {
        bottom: 16px;
    }

    /* Protect hero animations from reveal disable */
    .news-hero__slide--active .news-hero__badge,
    .news-hero__slide--active .news-hero__title,
    .news-hero__slide--active .news-hero__btn {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }

    /* About Section - Mobile */
    .about__grid {
        gap: 1.5rem !important;
    }

    .about__content {
        text-align: center;
    }

    .about__title {
        font-size: 1.25rem !important;
        line-height: 1.5;
    }

    .about__text {
        font-size: 0.875rem;
        line-height: 1.8;
    }

    .about__btn {
        display: inline-flex !important;
        width: auto !important;
        padding: 12px 28px !important;
        font-size: 0.875rem !important;
        justify-content: center !important;
        margin: 0 auto !important;
        background: var(--green-primary) !important;
        color: #fff !important;
        border-radius: 50px !important;
        text-decoration: none !important;
        gap: 10px !important;
        font-weight: 600 !important;
        border: 1px solid var(--green-primary) !important;
    }

    .about__image-wrapper {
        padding: var(--space-md) !important;
    }

    .about__image-wrapper img {
        max-width: 220px !important;
    }

    /* Contact */
    .contact-info {
        padding: 1rem;
    }

    /* Footer */
    .footer {
        padding: 2.5rem 0 1.5rem;
    }

    .footer__grid {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 2rem;
    }

    .footer__bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding-top: 1.5rem;
    }

    /* CTA Section */
    .cta {
        padding: 2.5rem 0;
    }

    .cta__title {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
    }

    .cta__desc {
        font-size: 0.9375rem;
    }

    /* Programs */
    .programs-logos {
        grid-template-columns: 1fr !important;
    }

    .program-logo-card {
        padding: 1.5rem;
    }

    .program-logo-card__image {
        max-width: 200px;
        height: 150px;
    }

    /* Hide decorative elements */
    .hero__decoration,
    .cta__decoration,
    .page-header__decoration,
    [class*="decoration"] {
        display: none !important;
    }

    /* Disable animations for performance */
    .reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* ================================================================================
   LARGE PHONES (481px - 640px)
   ================================================================================ */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 0.875rem;
    }

    .hero__title {
        font-size: 1.625rem !important;
    }

    .hero__stats {
        grid-template-columns: 1fr 1fr;
    }

    .stat-item__number {
        font-size: 1.75rem;
    }

    /* Smaller cards */
    .card__content {
        padding: 1rem;
    }

    .card__image {
        height: 160px;
    }

    /* About features */
    .about__features {
        grid-template-columns: 1fr !important;
    }

    /* News Hero - Large Phones */
    .news-hero {
        height: 50vh;
        min-height: 350px;
    }

    .news-hero__title {
        font-size: 1.25rem !important;
    }

    /* Programs */
    .program-logo-card__image {
        max-width: 160px;
        height: 120px;
    }
}

/* ================================================================================
   SMALL PHONES (320px - 480px)
   ================================================================================ */
@media (max-width: 480px) {
    :root {
        --space-xs: 0.25rem;
        --space-sm: 0.5rem;
        --space-md: 0.75rem;
        --space-lg: 1rem;
    }

    html {
        font-size: 13px;
    }

    .container {
        padding: 0 0.75rem;
    }

    /* Hero */
    .hero {
        padding-top: calc(var(--nav-height) + 1rem);
    }

    .hero__title {
        font-size: 1.375rem !important;
        line-height: 1.4;
    }

    .hero__desc {
        font-size: 0.875rem;
    }

    .hero__label {
        font-size: 0.7rem;
        padding: 0.4rem 0.75rem;
    }

    .hero__stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Navigation */
    .nav__logo-img {
        height: 38px;
    }

    /* Buttons */
    .btn {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }

    /* Section */
    .section {
        padding: 2rem 0;
    }

    .section-header__title {
        font-size: 1.25rem !important;
    }

    .section-header__desc {
        font-size: 0.875rem;
    }

    /* Page Header */
    .page-header {
        padding: 1.5rem 0;
        padding-top: calc(var(--nav-height) + 1rem);
    }

    .page-header__title {
        font-size: 1.25rem !important;
    }

    .page-header__desc {
        font-size: 0.8125rem;
    }

    /* Cards */
    .card {
        border-radius: 12px;
    }

    .card__content {
        padding: 0.875rem;
    }

    .card__title {
        font-size: 1rem;
    }

    .card__desc {
        font-size: 0.8125rem;
    }

    .card__image {
        height: 140px;
    }

    /* Stats */
    .stat-item {
        padding: 0.75rem;
    }

    .stat-item__number {
        font-size: 1.5rem;
    }

    .stat-item__label {
        font-size: 0.75rem;
    }

    /* News */
    .news-featured {
        height: 200px;
    }

    .news-featured__title {
        font-size: 1rem;
    }

    .news-item__title {
        font-size: 0.875rem;
    }

    /* News Hero - Small Phones */
    .news-hero {
        height: 45vh;
        min-height: 300px;
    }

    .news-hero__content {
        padding: 0 var(--space-sm);
        padding-bottom: 50px;
    }

    .news-hero__badge {
        font-size: 0.6875rem;
        padding: 4px 10px;
    }

    .news-hero__title {
        font-size: 1.125rem !important;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .news-hero__btn {
        padding: 8px 18px;
        font-size: 0.8125rem;
    }

    .news-hero__nav {
        width: 34px;
        height: 34px;
    }

    .news-hero__nav svg {
        width: 18px;
        height: 18px;
    }

    .news-hero__controls {
        bottom: 12px;
        gap: 10px;
    }

    .news-hero__counter {
        font-size: 0.75rem;
    }

    .news-hero__counter-current {
        font-size: 0.875rem;
    }

    .news-hero__progress {
        width: 50px;
    }

    /* Forms */
    .form-group {
        margin-bottom: 0.875rem;
    }

    .form-label {
        font-size: 0.8125rem;
        margin-bottom: 0.375rem;
    }

    .form-input,
    .form-textarea,
    .form-select {
        padding: 0.625rem 0.75rem;
    }

    /* Footer */
    .footer {
        padding: 2rem 0 1rem;
    }

    .footer__logo-img {
        height: 40px;
    }

    .footer__title {
        font-size: 1rem;
    }

    .footer__link {
        font-size: 0.8125rem;
    }

    /* CTA */
    .cta {
        padding: 2rem 0;
    }

    .cta__title {
        font-size: 1.25rem !important;
    }

    .cta__desc {
        font-size: 0.8125rem;
    }

    /* Program logos */
    .program-logo-card {
        padding: 1rem;
    }

    .program-logo-card__image {
        max-width: 140px;
        height: 100px;
    }

    .program-logo-card__title {
        font-size: 0.875rem;
    }

    /* About Section - Small Phones */
    .about__btn {
        padding: 10px 22px;
        font-size: 0.8125rem;
    }

    .about__image-wrapper img {
        max-width: 180px !important;
    }

    .about__feature {
        padding: 0.625rem 0.75rem;
    }

    .about__feature-text {
        font-size: 0.8125rem;
    }
}

/* ================================================================================
   EXTRA SMALL PHONES (320px and below)
   ================================================================================ */
@media (max-width: 320px) {
    html {
        font-size: 12px;
    }

    .container {
        padding: 0 0.5rem;
    }

    .nav__logo-img {
        height: 32px;
    }

    .btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }

    /* News Hero - Extra Small */
    .news-hero {
        height: 40vh;
        min-height: 280px;
    }

    .news-hero__title {
        font-size: 1rem !important;
    }

    .news-hero__badge {
        font-size: 0.625rem;
    }

    .news-hero__nav {
        display: none;
    }

    .news-hero__btn {
        padding: 7px 14px;
        font-size: 0.75rem;
    }
}

/* ================================================================================
   LANDSCAPE ORIENTATION (Mobile)
   ================================================================================ */
@media (max-width: 896px) and (orientation: landscape) {
    .nav__menu {
        padding-top: 1rem;
    }

    .nav__link {
        padding: 0.75rem 1.5rem;
    }

    /* News Hero - Landscape */
    .news-hero {
        height: 100vh;
        min-height: 280px;
        max-height: 350px;
    }

    .news-hero__content {
        padding-bottom: 45px;
    }

    .news-hero__title {
        font-size: 1.125rem !important;
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }

    .news-hero__nav {
        width: 34px;
        height: 34px;
        opacity: 1;
    }

    .news-hero__brand {
        display: none;
    }
}

/* ================================================================================
   HIGH DPI / RETINA DISPLAYS
   ================================================================================ */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    /* Sharper borders */
    .card,
    .btn,
    .form-input {
        border-width: 0.5px;
    }
}

/* ================================================================================
   DARK MODE PREFERENCE
   ================================================================================ */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles here if needed in the future */
}

/* ================================================================================
   REDUCED MOTION PREFERENCE
   ================================================================================ */
@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;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ================================================================================
   PRINT STYLES
   ================================================================================ */
@media print {

    .nav,
    .footer,
    .btn,
    .nav__toggle,
    .cta,
    .hero__decoration,
    [class*="decoration"] {
        display: none !important;
    }

    body {
        background: white;
        color: black;
        font-size: 12pt;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    h1,
    h2,
    h3 {
        page-break-after: avoid;
    }

    img {
        max-width: 100% !important;
    }

    a {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ================================================================================
   UTILITY CLASSES FOR RESPONSIVE
   ================================================================================ */

/* Hide on specific breakpoints */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .hide-tablet {
        display: none !important;
    }
}

/* Show only on specific breakpoints */
@media (min-width: 769px) {
    .show-mobile-only {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .show-desktop-only {
        display: none !important;
    }
}

/* Text alignment responsive */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }
}

/* Spacing responsive utilities */
@media (max-width: 768px) {
    .mt-mobile-0 {
        margin-top: 0 !important;
    }

    .mb-mobile-0 {
        margin-bottom: 0 !important;
    }

    .pt-mobile-0 {
        padding-top: 0 !important;
    }

    .pb-mobile-0 {
        padding-bottom: 0 !important;
    }
}