/* Comprehensive Responsive Design & Cross-Browser Compatibility */

/* ============================================
   Cursor Always Visible - CRITICAL
   ============================================ */

/* Force cursor to always be visible on all elements */
*, *::before, *::after {
    cursor: auto !important;
}

body, html {
    cursor: auto !important;
}

button, a, .download-btn, [role="button"], [onclick] {
    cursor: pointer !important;
}

input, textarea, select {
    cursor: text !important;
}

/* ============================================
   Base Responsive Styles
   ============================================ */

/* Extra Small Devices (phones, 320px and up) */
@media (max-width: 575.98px) {
    /* Typography */
    h1 {
        font-size: 2rem !important;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.75rem !important;
    }
    
    h3 {
        font-size: 1.5rem !important;
    }
    
    .text-5xl {
        font-size: 2.5rem !important;
    }
    
    .text-4xl {
        font-size: 2rem !important;
    }
    
    .text-3xl {
        font-size: 1.75rem !important;
    }
    
    .text-xl {
        font-size: 1rem !important;
    }
    
    /* Spacing */
    .py-20 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    .py-16 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .mb-12 {
        margin-bottom: 2rem !important;
    }
    
    /* Navigation */
    .text-2xl {
        font-size: 1.25rem !important;
    }
    
    /* Buttons */
    .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .py-4 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    /* Grid */
    .grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
    
    /* Statistics Cards */
    .text-3xl {
        font-size: 1.5rem !important;
    }
    
    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Container */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    h1 {
        font-size: 2.5rem;
    }
    
    .text-5xl {
        font-size: 3rem;
    }
    
    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .md\:grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .md\:grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) {
    /* Full desktop styles */
}

/* ============================================
   Mobile Menu Styles
   ============================================ */

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.98);
    z-index: 9999;
    overflow-y: auto;
    padding: 2rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.mobile-menu.active {
    display: block;
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mobile-menu-links a {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
    padding: 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s;
}

.mobile-menu-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   Cross-Browser Compatibility
   ============================================ */

/* Flexbox fallback for older browsers */
.flex {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

/* Grid fallback */
.grid {
    display: -ms-grid;
    display: grid;
}

/* Backdrop filter fallback */
.backdrop-blur-sm {
    background-color: rgba(255, 255, 255, 0.1);
}

@supports (backdrop-filter: blur(4px)) {
    .backdrop-blur-sm {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
}

/* Transform fallback */
[data-float] {
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

/* Animation fallback */
@-webkit-keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================
   Touch Device Optimizations
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button, a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .hover\:shadow-lg:hover {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .gradient-bg {
        background: #667eea !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .mobile-menu,
    .mobile-menu-btn,
    button {
        display: none !important;
    }
    
    a {
        text-decoration: underline;
    }
}

/* ============================================
   High DPI Displays
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ============================================
   Landscape Orientation
   ============================================ */

@media (orientation: landscape) and (max-height: 500px) {
    .py-20 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .py-16 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* ============================================
   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;
    }
    
    [data-float] {
        transform: none !important;
    }
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles if needed */
}

/* ============================================
   Container Responsive Adjustments
   ============================================ */

.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;
    }
}

/* ============================================
   Modal Responsive
   ============================================ */

.modal-content {
    width: 90%;
    max-width: 500px;
    margin: 1rem;
}

@media (max-width: 640px) {
    .modal-content {
        width: 95%;
        margin: 0.5rem;
        padding: 1rem;
    }
}

/* ============================================
   Table Responsive
   ============================================ */

@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    thead {
        display: none;
    }
    
    tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 1rem;
    }
    
    tbody td {
        display: block;
        text-align: right;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f3f4f6;
    }
    
    tbody td::before {
        content: attr(data-label) ": ";
        font-weight: bold;
        float: left;
    }
}

/* ============================================
   Image Responsive
   ============================================ */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   Button Responsive
   ============================================ */

@media (max-width: 640px) {
    .download-btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .flex-wrap {
        flex-direction: column;
    }
}

/* ============================================
   News Ticker Responsive
   ============================================ */

@media (max-width: 640px) {
    #newsTicker {
        font-size: 0.875rem;
    }
    
    .news-ticker {
        padding: 0.5rem;
    }
}

/* ============================================
   Statistics Cards Responsive
   ============================================ */

@media (max-width: 640px) {
    .grid.grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .bg-white.bg-opacity-20 {
        padding: 1rem;
    }
}

/* ============================================
   Footer Responsive
   ============================================ */

@media (max-width: 768px) {
    footer .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
}

/* ============================================
   Form Elements Responsive
   ============================================ */

input, textarea, select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    input, textarea, select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ============================================
   Particle Canvas Responsive
   ============================================ */

#particleCanvas {
    width: 100% !important;
    height: 100% !important;
}

/* ============================================
   Text Overflow
   ============================================ */

.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .text-ellipsis {
        white-space: normal;
        word-wrap: break-word;
    }
}

