@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Poppins:wght@400;500;600;700;800&display=swap');

/* Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;
    
    --accent-400: #e879f9;
    --accent-500: #d946ef;
    --accent-600: #c026d3;
    
    --dark-100: #1e1e2e;
    --dark-200: #181825;
    --dark-300: #11111b;
    --dark-400: #0a0a0f;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--dark-300);
    color: #ffffff;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark-300);
}

::-webkit-scrollbar-thumb {
    background: var(--dark-100);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-600);
}

/* Typography */
.font-display {
    font-family: 'Poppins', system-ui, sans-serif;
}

/* Container - Mobile First */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Fix body overflow on mobile */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(14, 165, 233, 0.4); }
    50% { box-shadow: 0 0 40px rgba(14, 165, 233, 0.8); }
}

@keyframes slide-up {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

.animate-slide-up {
    animation: slide-up 0.5s ease-out;
}

.animate-fade-in {
    animation: fade-in 0.5s ease-out;
}

.animate-gradient {
    animation: gradient 3s ease infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Navbar */
#navbar {
    background: rgba(17, 17, 27, 0.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

#navbar.scrolled {
    background: rgba(17, 17, 27, 0.95);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-link {
    position: relative;
    color: #94a3b8;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #ffffff;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    box-shadow: 0 8px 30px rgba(14, 165, 233, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Cards */
.card {
    background: linear-gradient(135deg, var(--dark-100), var(--dark-200));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    transition: all 0.5s ease;
}

.card:hover {
    border-color: rgba(14, 165, 233, 0.5);
    box-shadow: 0 20px 50px rgba(14, 165, 233, 0.1);
    transform: translateY(-5px);
}

/* Form Inputs */
.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.form-input::placeholder {
    color: #64748b;
}

/* Labels */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #cbd5e1;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.alert-info {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #0ea5e9;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-primary {
    background: rgba(14, 165, 233, 0.2);
    color: #0ea5e9;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--dark-200);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--dark-100);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* Pricing Card Popular Badge */
.pricing-popular {
    position: relative;
}

.pricing-popular::before {
    content: 'POPULAR';
    position: absolute;
    top: -12px;
    right: 20px;
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    padding: 0.25rem 1rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-400), var(--accent-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Grid Background Pattern */
.grid-pattern {
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Glow Effects */
.glow-primary {
    box-shadow: 0 0 30px rgba(14, 165, 233, 0.3);
}

.glow-accent {
    box-shadow: 0 0 30px rgba(217, 70, 239, 0.3);
}

.glow-success {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

/* Status Dots */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-online {
    background: var(--success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.status-offline {
    background: var(--danger);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.status-pending {
    background: var(--warning);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-400) 0%, var(--accent-400) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bg-glass {
    background: rgba(255, 255, 255, 0.05);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
}

/* ==========================================
   MOBILE RESPONSIVE STYLES
   iPhone SE: 375px
   iPhone 12/13/14: 390px
   iPhone 12/13/14 Pro Max: 428px
   Android Small: 360px
   Android Medium: 412px
   ========================================== */

/* Extra Small Devices (iPhone SE, small Android) */
@media (max-width: 380px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
}

/* Small Mobile Devices (most phones) */
@media (max-width: 480px) {
    /* Typography */
    h1 {
        font-size: 1.875rem !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    /* Hero Section */
    #hero {
        padding-top: 5rem;
        min-height: auto;
    }
    
    #hero .text-4xl,
    #hero .md\\:text-5xl,
    #hero .lg\\:text-6xl {
        font-size: 1.75rem !important;
        line-height: 1.25 !important;
    }
    
    #hero p {
        font-size: 0.95rem;
    }
    
    /* Stats Grid on Hero */
    #hero .grid-cols-3 {
        gap: 1rem;
    }
    
    #hero .grid-cols-3 .text-3xl {
        font-size: 1.25rem !important;
    }
    
    #hero .grid-cols-3 .text-sm {
        font-size: 0.7rem !important;
    }
    
    /* Buttons */
    #hero a.px-8 {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Cards */
    .group.relative {
        padding: 1.25rem;
    }
    
    .group.relative h3 {
        font-size: 1.25rem;
    }
    
    .group.relative p {
        font-size: 0.875rem;
    }
    
    /* Feature items */
    .flex.items-start.space-x-4 {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .flex.items-start.space-x-4 > div:first-child {
        flex-shrink: 0;
    }
    
    /* Pricing in cards */
    .text-2xl.font-bold {
        font-size: 1.5rem !important;
    }
    
    /* Footer */
    footer .grid {
        gap: 1.5rem;
    }
}

/* Medium Mobile (iPhone 12/13/14, larger Android) */
@media (min-width: 381px) and (max-width: 480px) {
    h1 {
        font-size: 2rem !important;
    }
    
    #hero .text-4xl,
    #hero .md\\:text-5xl {
        font-size: 2rem !important;
    }
}

/* Tablet Portrait and Below */
@media (max-width: 768px) {
    /* Navigation */
    nav .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Logo */
    nav .text-xl {
        font-size: 1.125rem;
    }
    
    nav .w-10.h-10 {
        width: 2.25rem;
        height: 2.25rem;
    }
    
    /* Sections */
    section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    /* Services Grid */
    #services .grid {
        gap: 1rem;
    }
    
    /* Features Section */
    #features .grid {
        gap: 2rem;
    }
    
    #features .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    #features .grid-cols-2 > div {
        margin-top: 0 !important;
    }
    
    #features .text-4xl {
        font-size: 1.75rem !important;
    }
    
    /* Game cards */
    .game-card {
        padding: 1rem;
    }
    
    /* Testimonials */
    .testimonial-card {
        padding: 1.25rem;
    }
    
    /* FAQ */
    .faq-item {
        padding: 1rem;
    }
}

/* Safe Area for iPhone X and newer (notch handling) */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    nav {
        padding-top: max(0px, env(safe-area-inset-top));
    }
    
    #mobile-menu {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Touch-friendly targets */
@media (pointer: coarse) {
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Larger tap targets for mobile menu items */
    #mobile-menu a {
        min-height: 52px;
        display: flex;
        align-items: center;
    }
    
    /* Form inputs */
    input, select, textarea {
        min-height: 48px;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

/* Landscape mode on phones */
@media (max-height: 500px) and (orientation: landscape) {
    #hero {
        min-height: auto;
        padding-top: 5rem;
        padding-bottom: 2rem;
    }
    
    #hero h1 {
        font-size: 1.75rem !important;
    }
    
    #hero .grid-cols-3 {
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}

/* High DPI screens (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp borders */
    .border {
        border-width: 0.5px;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Dark mode adjustments for OLED screens */
@media (prefers-color-scheme: dark) {
    :root {
        --dark-300: #000000;
        --dark-400: #000000;
    }
}

/* ==========================================
   CLIENT AREA MOBILE STYLES
   ========================================== */

/* Sidebar for client area on mobile */
@media (max-width: 1023px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    #sidebar.active {
        transform: translateX(0);
    }
    
    /* Sidebar overlay */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 39;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Main content when sidebar is closed */
    main {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Client area cards on mobile */
@media (max-width: 640px) {
    .stat-card,
    .service-card {
        padding: 1rem;
    }
    
    .stat-card h3 {
        font-size: 0.875rem;
    }
    
    .stat-card .text-3xl {
        font-size: 1.5rem;
    }
}

/* Preloader styles */
#preloader {
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Mobile Menu Animation */
#mobile-menu {
    position: fixed !important;
    top: 64px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(15, 23, 42, 0.98) !important;
    z-index: 9998 !important;
    transform: translateX(100%);
    transition: transform 0.3s ease !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 640px) {
    #mobile-menu {
        top: 80px !important;
    }
}

#mobile-menu.active {
    transform: translateX(0%) !important;
}

/* Mobile menu button z-index */
#mobile-menu-btn {
    z-index: 9999 !important;
    position: relative !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Selection styling */
::selection {
    background: var(--primary-500);
    color: white;
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .no-print {
        display: none !important;
    }
}
