/* Enhanced Responsive Design - CoinMENA */
/* Comprehensive responsive styles for all devices and screen sizes */

/* Base responsive container */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}

@media (min-width: 1536px) {
    .container {
        max-width: 1536px;
    }
}

/* Mobile First - Extra Small Devices (phones, 320px and up) */
@media screen and (min-width: 320px) {
    .xs\:text-xs { font-size: 0.75rem; }
    .xs\:text-sm { font-size: 0.875rem; }
    .xs\:p-2 { padding: 0.5rem; }
    .xs\:p-4 { padding: 1rem; }
}

/* Small Devices (landscape phones, 576px and up) */
@media screen and (min-width: 576px) {
    .sm\:text-base { font-size: 1rem; }
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:flex-row { flex-direction: row; }
}

/* Medium Devices (tablets, 768px and up) */
@media screen and (min-width: 768px) {
    .md\:text-lg { font-size: 1.125rem; }
    .md\:text-xl { font-size: 1.25rem; }
    .md\:text-2xl { font-size: 1.5rem; }
    .md\:text-3xl { font-size: 1.875rem; }
    .md\:text-4xl { font-size: 2.25rem; }
    .md\:text-5xl { font-size: 3rem; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:flex { display: flex; }
    .md\:hidden { display: none; }
    .md\:block { display: block; }
    .md\:p-6 { padding: 1.5rem; }
    .md\:p-8 { padding: 2rem; }
    .md\:py-12 { padding-top: 3rem; padding-bottom: 3rem; }
    .md\:py-16 { padding-top: 4rem; padding-bottom: 4rem; }
    .md\:py-20 { padding-top: 5rem; padding-bottom: 5rem; }
}

/* Large Devices (desktops, 1024px and up) */
@media screen and (min-width: 1024px) {
    .lg\:text-6xl { font-size: 3.75rem; }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:flex-row { flex-direction: row; }
    .lg\:space-x-8 > * + * { margin-right: 2rem; }
}

/* Extra Large Devices (large desktops, 1280px and up) */
@media screen and (min-width: 1280px) {
    .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .xl\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* 2XL Devices (larger desktops, 1536px and up) */
@media screen and (min-width: 1536px) {
    .\32xl\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Mobile Specific Adjustments */
@media screen and (max-width: 767px) {
    /* Hide desktop elements on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Full width on mobile */
    .mobile-full {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Stack elements vertically on mobile */
    .mobile-stack {
        flex-direction: column !important;
    }
    
    /* Reduce padding on mobile */
    .mobile-padding {
        padding: 1rem !important;
    }
    
    /* Smaller text on mobile */
    .mobile-text {
        font-size: 0.875rem !important;
    }
    
    /* Center align on mobile */
    .mobile-center {
        text-align: center !important;
    }
    
    /* Full width buttons on mobile */
    button.mobile-full,
    a.mobile-full {
        width: 100% !important;
        display: block !important;
    }
    
    /* Adjust table for mobile */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Stack grid items on mobile */
    .grid {
        grid-template-columns: 1fr !important;
    }
}

/* Tablet Specific Adjustments */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .tablet-2-col {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    
    .tablet-center {
        text-align: center;
    }
}

/* Desktop Specific Adjustments */
@media screen and (min-width: 1024px) {
    .desktop-3-col {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
    
    .desktop-4-col {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

/* Orientation Specific */
@media screen and (orientation: portrait) {
    .portrait-adjust {
        padding: 2rem 1rem;
    }
}

@media screen and (orientation: landscape) {
    .landscape-adjust {
        padding: 1rem 2rem;
    }
    
    /* Reduce height in landscape on mobile */
    @media screen and (max-height: 500px) {
        .landscape-compact {
            padding-top: 1rem;
            padding-bottom: 1rem;
        }
        
        h1 {
            font-size: 1.5rem !important;
        }
        
        h2 {
            font-size: 1.25rem !important;
        }
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button, a, .clickable {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
    }
    
    /* Remove hover effects on touch devices */
    .hover-lift:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Active state instead of hover */
    .hover-lift:active {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders */
    .retina-border {
        border-width: 0.5px;
    }
}

/* Print Styles */
@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a, a:visited {
        color: #000 !important;
        text-decoration: underline;
    }
    
    .no-print {
        display: none !important;
    }
    
    .print-break {
        page-break-after: always;
    }
    
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}

/* Reduced Motion (Accessibility) */
@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;
    }
}

/* Dark Mode Media Query */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background-color: #1f2937;
        color: #f9fafb;
    }
}

/* Very Small Screens (320px and below) */
@media screen and (max-width: 320px) {
    .tiny-screen {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Large Screens (1920px and up) */
@media screen and (min-width: 1920px) {
    .large-screen {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* Ultra-wide Screens (2560px and up) */
@media screen and (min-width: 2560px) {
    .ultra-wide {
        max-width: 1600px;
        margin: 0 auto;
    }
}

/* Flexible Images */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Responsive Tables */
@media screen and (max-width: 767px) {
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    thead {
        display: none;
    }
    
    tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 0.5rem;
    }
    
    td {
        display: block;
        text-align: right;
        padding: 0.5rem;
        border-bottom: 1px solid #e5e7eb;
    }
    
    td:before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        width: 50%;
    }
}

/* Responsive Navigation */
@media screen and (max-width: 767px) {
    nav {
        flex-wrap: wrap;
    }
    
    .nav-menu {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .nav-menu.active {
        max-height: 500px;
    }
}

/* Responsive Forms */
@media screen and (max-width: 767px) {
    form {
        width: 100%;
    }
    
    input, textarea, select {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .form-row {
        flex-direction: column;
    }
}

/* Responsive Cards */
@media screen and (max-width: 767px) {
    .card {
        width: 100%;
        margin-bottom: 1rem;
    }
}

/* Responsive Modals */
@media screen and (max-width: 767px) {
    .modal {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
        padding: 1rem;
    }
}

/* Safe Area for Notched Devices */
@supports (padding: max(0px)) {
    .safe-area-top {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
    
    .safe-area-bottom {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .safe-area-left {
        padding-left: max(1rem, env(safe-area-inset-left));
    }
    
    .safe-area-right {
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Viewport Height Fix for Mobile */
.full-height {
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Prevent text size adjustment on iOS */
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

