/* Base styles - Tailwind CDN will handle utility classes */

/* ===== MOBILE-FIRST RESPONSIVE STYLES ===== */

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

/* Better touch targets for mobile */
@media (max-width: 768px) {
    button, a, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

/* Responsive tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}

@media (max-width: 768px) {
    .table-responsive table {
        min-width: 600px;
    }
    
    /* Stack table cells on very small screens */
    .table-stack-mobile thead {
        display: none;
    }
    
    .table-stack-mobile tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid rgba(75, 85, 99, 0.5);
        border-radius: 0.5rem;
        padding: 0.5rem;
    }
    
    .table-stack-mobile tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
        border-bottom: 1px solid rgba(75, 85, 99, 0.3);
    }
    
    .table-stack-mobile tbody td:last-child {
        border-bottom: none;
    }
    
    .table-stack-mobile tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: #9CA3AF;
        text-transform: uppercase;
    }
}

/* Mobile navigation improvements */
@media (max-width: 768px) {
    .nav-mobile-menu {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.95);
        z-index: 100;
        padding: 2rem;
        overflow-y: auto;
    }
}

/* Mobile card improvements */
@media (max-width: 640px) {
    .card-mobile {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        border-radius: 0;
    }
}

/* Stats grid mobile layout */
@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    .stats-grid > *:last-child:nth-child(odd) {
        grid-column: span 2;
    }
}

/* Modal responsive */
@media (max-width: 640px) {
    .modal-content {
        margin: 0.5rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
}

/* Better spacing on mobile */
@media (max-width: 640px) {
    .section-padding {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .heading-mobile {
        font-size: 1.5rem !important;
    }
}

/* Footer mobile improvements */
@media (max-width: 768px) {
    footer .grid {
        text-align: center;
    }
    
    footer .flex.space-x-4 {
        justify-content: center;
    }
}

/* Search bar mobile */
@media (max-width: 640px) {
    #lotterySearch {
        font-size: 16px !important;
        padding: 0.875rem 1rem 0.875rem 2.75rem !important;
    }
}

/* Lottery cards mobile */
@media (max-width: 640px) {
    .lottery-card {
        margin-bottom: 1rem;
    }
    
    .lottery-card img {
        max-width: 80px;
        max-height: 80px;
    }
}

/* Dashboard improvements */
@media (max-width: 768px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .referral-link-input {
        font-size: 12px !important;
    }
}

/* Winners page mobile */
@media (max-width: 640px) {
    .winner-card {
        padding: 1rem;
    }
    
    .winner-amount {
        font-size: 1.25rem;
    }
}

/* Form mobile improvements */
@media (max-width: 640px) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }
    
    .form-input {
        padding: 0.75rem 1rem;
    }
}

/* Button mobile - full width on small screens */
@media (max-width: 480px) {
    .btn-mobile-full {
        width: 100%;
        justify-content: center;
    }
}

/* Hide decorative elements on mobile for performance */
@media (max-width: 640px) {
    .decorative-orb,
    .blur-effect-large {
        display: none !important;
    }
}

/* Improve text readability on mobile */
@media (max-width: 640px) {
    body {
        font-size: 14px;
        line-height: 1.6;
    }
    
    p, li {
        font-size: 0.9375rem;
    }
}

/* Fix sticky header on mobile */
@media (max-width: 768px) {
    .sticky-header {
        position: sticky;
        top: 0;
        z-index: 50;
    }
}

/* Animations - reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Safe area insets for notched phones */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(31, 41, 55, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.5);
}

/* Hide scrollbar on mobile but keep functionality */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 0;
        height: 0;
    }
}