/* Custom CSS for XinfinityGroup Django Application */

/* Critical mobile viewport fixes - MUST BE FIRST */
html {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
}

body {
    width: 100%;
    min-width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    position: relative;
}

/* Prevent horizontal scroll and zoom issues on mobile */
* {
    box-sizing: border-box;
}

/* Ensure all containers respect viewport width */
.container, [class*="container"] {
    max-width: 100%;
    overflow-x: hidden;
}

/* Prevent images from overflowing */
img {
    max-width: 100%;
    height: auto;
}

/* Additional animations and effects */
.fade-in {
    animation: fadeIn 0.8s ease-in-out;
}

.slide-up {
    animation: slideUp 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Grid background pattern */
.bg-grid-slate-100 {
    background-image: url("data:image/svg+xml,%3csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3e%3cg fill='%23f1f5f9' fill-opacity='0.4' fill-rule='evenodd'%3e%3cpath d='m0 40 40-40h-40v40zm40 0v-40h-40l40 40z'/%3e%3c/g%3e%3c/svg%3e");
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Form focus states */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Button hover effects */
.professional-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.2);
}

.professional-btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Card hover effects */
.professional-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Responsive utilities */
@media (max-width: 768px) {
    /* Prevent zoom and overflow issues */
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    /* Ensure all elements fit within viewport */
    * {
        max-width: 100vw;
    }
    
    img {
        max-width: 100%;
        height: auto;
    }
    
    .professional-hero {
        padding-top: 6rem;
        padding-bottom: 4rem;
        overflow-x: hidden;
    }
    
    .professional-hero-small {
        padding-top: 5rem;
        padding-bottom: 3rem;
    }
    
    .text-5xl {
        font-size: 2.5rem;
    }
    
    .text-6xl {
        font-size: 3rem;
    }
    
    /* Fix button overflow */
    .professional-btn-primary,
    .professional-btn-secondary {
        white-space: normal;
        word-wrap: break-word;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .professional-hero {
        background: white !important;
        color: black !important;
    }
    
    .professional-btn-primary,
    .professional-btn-secondary {
        border: 1px solid black !important;
        background: white !important;
        color: black !important;
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible for better keyboard navigation */
.focus-visible:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .professional-card {
        border: 2px solid #000;
    }
    
    .professional-btn-primary {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .fade-in,
    .slide-up {
        animation: none;
    }
}

/* Base theme and layout (moved from inline styles) */
:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --primary: 200 100% 50%;
    --primary-foreground: 0 0% 100%;
    --primary-hover: 200 100% 45%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 200 100% 95%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --surface: 200 100% 98%;
    --border: 200 50% 90%;
    --input: 214.3 31.8% 91.4%;
    --ring: 200 100% 50%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --success: 142 76% 36%;
    --warning: 38 92% 50%;
    --radius: 0.75rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: "rlig" 1, "calt" 1;
    line-height: 1.6;
}

.professional-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.professional-section {
    padding: 4rem 0;
}

.professional-hero {
    display: flex;
    align-items: center;
}

.professional-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgb(226 232 240);
}

.professional-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.professional-btn-primary {
    background: rgb(14 165 233);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.professional-btn-primary:hover {
    background: rgb(2 132 199);
    transform: translateY(-1px);
}

.professional-btn-secondary {
    background: transparent;
    color: rgb(71 85 105);
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s;
    border: 2px solid rgb(203 213 225);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.professional-btn-secondary:hover {
    border-color: rgb(148 163 184);
    background: rgb(248 250 252);
}

.professional-gradient-text {
    color: rgb(59 130 246);
    background: linear-gradient(135deg, rgb(14 165 233), rgb(59 130 246), rgb(147 51 234));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.professional-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgb(219 234 254);
    color: rgb(30 64 175);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    gap: 0.5rem;
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.8s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .professional-container {
        padding: 0 1rem;
    }

    .professional-section {
        padding: 2rem 0;
    }

    .professional-hero {
        min-height: 80vh;
        padding-top: 4rem;
    }

    .professional-btn-primary,
    .professional-btn-secondary {
        padding: 0.875rem 1.5rem;
        font-size: 0.875rem;
        width: 100%;
        justify-content: center;
    }

    h1 {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }

    h2 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
    }

    h3 {
        font-size: 1.5rem !important;
        line-height: 1.4 !important;
    }

    .text-xl {
        font-size: 1.125rem !important;
    }

    .text-4xl {
        font-size: 2rem !important;
    }

    .text-5xl {
        font-size: 2.5rem !important;
    }
}

@media (max-width: 640px) {
    /* Strict mobile viewport control */
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        touch-action: manipulation;
    }
    
    body {
        overflow-x: hidden;
        width: 100%;
        min-width: 100%;
        max-width: 100vw;
    }
    
    /* Prevent any element from causing horizontal scroll */
    * {
        max-width: 100%;
    }
    
    .professional-container {
        padding: 0 0.75rem;
        width: 100%;
        max-width: 100%;
    }

    .professional-section {
        padding: 1.5rem 0;
        overflow-x: hidden;
    }

    .professional-hero {
        min-height: 70vh;
        padding-top: 3rem;
        overflow-x: hidden;
    }

    h1 {
        font-size: 1.75rem !important;
        word-wrap: break-word;
    }

    h2 {
        font-size: 1.5rem !important;
        word-wrap: break-word;
    }

    .text-xl {
        font-size: 1rem !important;
    }
    
    /* Ensure buttons don't overflow */
    button, .professional-btn-primary, .professional-btn-secondary {
        max-width: 100%;
        white-space: normal;
    }
    
    /* Fix image overflow */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Fix container overflow */
    .container, [class*="container"] {
        max-width: 100%;
        overflow-x: hidden;
    }
}

.mobile-menu {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    min-height: 100vh;
    height: 100%;
}

.mobile-menu.open {
    transform: translateX(0);
}

@media (max-width: 480px) {
    .mobile-menu {
        padding-top: env(safe-area-inset-top, 0);
    }
}

@media (max-width: 1024px) {
    .group:hover .group-hover\:opacity-100 {
        opacity: 0 !important;
        visibility: hidden !important;
    }

    .group:hover .group-hover\:visible {
        visibility: hidden !important;
    }
}
