/* bim-gis-website/public/css/responsive.css */
/* Responsive styles for BIM/GIS Consulting Website */

/* ==========================================================================
   Base Responsive Settings
   ========================================================================== */

@media screen and (max-width: 1200px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .hero h1 {
        font-size: 3rem;
    }
    
    .section-header h2 {
        font-size: 2.25rem;
    }
}

/* ==========================================================================
   Tablet Styles (768px - 1024px)
   ========================================================================== */

@media screen and (max-width: 1024px) {
    /* General Styles */
    .container {
        padding: 0 1.25rem;
    }
    
    html {
        font-size: 15px;
    }
    
    /* Navigation */
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--white);
        flex-direction: column;
        padding: 1.5rem;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--gray-200);
        gap: 0;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        margin: 0;
        width: 100%;
    }
    
    .nav-menu a {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .nav-menu a:last-child {
        border-bottom: none;
    }
    
    .nav-menu a::after {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    /* Language Switcher */
    .language-switcher {
        top: 0.75rem;
        right: 4.5rem;
        padding: 0.25rem;
    }
    
    .lang-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    /* Theme Switcher */
    .theme-switcher {
        top: 0.75rem;
        right: 1rem;
        width: 36px;
        height: 36px;
    }
    
    /* Hero Section */
    .hero {
        padding: 4rem 0;
        min-height: auto;
    }
    
    .hero-content {
        padding: 0 1rem;
    }
    
    .hero h1 {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .hero p {
        font-size: 1.125rem;
        margin-bottom: 2rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        margin-bottom: 2.5rem;
    }
    
    .cta-button {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .stat-number {
        font-size: 2.5rem;
    }
    
    .hero-scroll {
        display: none;
    }
    
    /* Services Section */
    .services-intro {
        text-align: center;
        font-size: 1.2rem;
        margin-bottom: var(--spacing-xl);
        color: var(--text-light);
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .service-card {
        padding: 1.5rem;
    }
    
    .service-icon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    /* Solutions Section */
    .solutions-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .solution-card {
        padding: 1.5rem;
    }
    
    /* Training Section */
    .training-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .training-card {
        padding: 1.5rem;
    }
    
    /* Newsletter Section */
    .newsletter-content {
        padding: 0 1rem;
    }
    
    .form-group {
        flex-direction: column;
    }
    
    /* Contact Section */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-info,
    .contact-form {
        padding: 1.5rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .footer-section:first-child {
        grid-column: 1 / -1;
    }
    
    /* 404 Page */
    .error-content {
        margin: 0 1rem;
        padding: 2rem;
    }
    
    .error-code {
        font-size: 4rem;
    }
    
    .error-title {
        font-size: 1.75rem;
    }
    
    .error-icon {
        font-size: 5rem;
    }
    
    .error-actions {
        flex-direction: column;
    }
    
    .error-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   Mobile Styles (320px - 767px)
   ========================================================================== */

@media screen and (max-width: 767px) {
    /* General Styles */
    .container {
        padding: 0 1rem;
    }
    
    html {
        font-size: 14px;
    }
    
    section {
        padding: 3rem 0;
    }
    
    /* Navigation */
    .nav-container {
        padding: 1rem 0;
    }
    
    .logo img {
        height: 35px;
    }
    
    /* Language Switcher */
    .language-switcher {
        top: auto;
        bottom: 1rem;
        right: 1rem;
        flex-direction: column;
        padding: 0.25rem;
    }
    
    .lang-btn {
        padding: 0.5rem;
        font-size: 0.7rem;
    }
    
    .lang-btn i {
        font-size: 0.6rem;
    }
    
    /* Theme Switcher */
    .theme-switcher {
        top: auto;
        bottom: 1rem;
        right: 4.5rem;
    }
    
    /* Hero Section */
    .hero {
        padding: 3rem 0 4rem;
    }
    
    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    /* Section Headers */
    .section-header h2 {
        font-size: 1.75rem;
        margin-bottom: 0.5rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    /* Services Section */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .service-card {
        padding: 1.25rem;
    }
    
    .service-card h3 {
        font-size: 1.25rem;
    }
    
    /* Solutions Section */
    .solution-card h3 {
        font-size: 1.25rem;
    }
    
    .solution-icon img {
        max-width: 100px;
    }
    
    /* Training Section */
    .training-card h3 {
        font-size: 1.25rem;
    }
    
    /* Newsletter Section */
    .newsletter h3 {
        font-size: 1.5rem;
    }
    
    /* Contact Section */
    .contact-info h3 {
        font-size: 1.5rem;
    }
    
    .contact-item {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .contact-item i {
        margin-top: 0;
    }
    
    /* Form Elements */
    .form-group {
        margin-bottom: 1rem;
    }
    
    input, select, textarea {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    button, .cta-button, .submit-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .footer-bottom {
        text-align: center;
        padding-top: 1.5rem;
    }
    
    /* Utility Classes */
    .hide-on-mobile {
        display: none !important;
    }
    
    .show-on-mobile {
        display: block !important;
    }
    
    /* 404 Page */
    .error-content {
        padding: 1.5rem;
    }
    
    .error-code {
        font-size: 3rem;
    }
    
    .error-title {
        font-size: 1.5rem;
    }
    
    .error-message {
        font-size: 1rem;
    }
    
    .error-icon {
        font-size: 4rem;
    }
    
    .error-links-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Small Mobile Styles (320px - 480px)
   ========================================================================== */

@media screen and (max-width: 480px) {
    /* Hero Section */
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero p {
        font-size: 0.875rem;
    }
    
    /* Navigation */
    .nav-menu {
        padding: 1rem;
    }
    
    .nav-menu a {
        padding: 0.5rem 0;
    }
    
    /* Cards */
    .service-card,
    .solution-card,
    .training-card {
        padding: 1rem;
    }
    
    /* Statistics */
    .hero-stats {
        gap: 1rem;
    }
    
    .stat-number {
        font-size: 1.75rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* Contact Form */
    .contact-info,
    .contact-form {
        padding: 1rem;
    }
    
    /* Footer */
    .footer-section {
        padding: 0;
    }
    
    .footer-section h4 {
        margin-bottom: 0.75rem;
        font-size: 1rem;
    }
    
    /* Error Page */
    .error-content {
        padding: 1rem;
    }
    
    .error-code {
        font-size: 2.5rem;
    }
    
    .error-title {
        font-size: 1.25rem;
    }
}

/* ==========================================================================
   Landscape Orientation
   ========================================================================== */

@media screen and (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 2rem 0;
    }
    
    .hero-content {
        padding-top: 2rem;
    }
    
    .hero h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .hero p {
        margin-bottom: 1rem;
    }
    
    .hero-actions {
        margin-bottom: 1.5rem;
    }
    
    .hero-stats {
        margin-top: 1.5rem;
    }
}

/* ==========================================================================
   High-Density (Retina) Displays
   ========================================================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img,
    .solution-icon img,
    .footer-section img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .language-switcher,
    .theme-switcher,
    .mobile-menu-btn,
    .hero-scroll,
    .newsletter,
    .contact-form,
    .social-links,
    .cta-button,
    .scroll-down,
    .hero-stats {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000 !important;
        background: #fff !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .hero {
        background: #fff !important;
        color: #000 !important;
        padding: 1cm 0 !important;
    }
    
    .hero h1 {
        color: #000 !important;
        font-size: 24pt !important;
    }
    
    .hero p {
        color: #333 !important;
        font-size: 12pt !important;
    }
    
    section {
        page-break-inside: avoid;
        padding: 1cm 0 !important;
    }
    
    .services-grid,
    .solutions-grid,
    .training-grid {
        display: block;
    }
    
    .service-card,
    .solution-card,
    .training-card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        margin-bottom: 0.5cm;
        page-break-inside: avoid;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
    }
    
    footer {
        border-top: 1px solid #000;
        margin-top: 2cm;
        padding-top: 1cm;
    }
    
    .footer-content {
        display: block;
    }
    
    .footer-section {
        margin-bottom: 0.5cm;
    }
}

/* ==========================================================================
   Touch Device Optimizations
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch target sizes */
    .nav-menu a,
    .cta-button,
    .submit-btn,
    .lang-btn,
    .theme-switcher,
    .error-btn,
    .search-btn,
    .notification-close,
    .toast-close {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-menu a {
        padding: 1rem 0;
    }
    
    /* Remove hover effects */
    .service-card:hover,
    .solution-card:hover,
    .training-card:hover {
        transform: none;
    }
    
    /* Adjust for touch scrolling */
    .hero-scroll {
        display: none;
    }
    
    /* Prevent text size adjustment on orientation change */
    html {
        -webkit-text-size-adjust: 100%;
    }
}

/* ==========================================================================
   Large Desktop Screens (1920px+)
   ========================================================================== */

@media screen and (min-width: 1920px) {
    .container {
        max-width: 1400px;
    }
    
    .hero h1 {
        font-size: 4rem;
    }
    
    .hero p {
        font-size: 1.5rem;
    }
    
    .section-header h2 {
        font-size: 3rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .training-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   Very Small Mobile Screens (under 320px)
   ========================================================================== */

@media screen and (max-width: 320px) {
    html {
        font-size: 13px;
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 0.75rem;
    }
    
    .cta-button {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    .language-switcher {
        right: 0.5rem;
        bottom: 0.5rem;
    }
    
    .theme-switcher {
        right: 4rem;
        bottom: 0.5rem;
    }
}

/* ==========================================================================
   Tablet Landscape (768px - 1024px, landscape)
   ========================================================================== */

@media screen and (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .hero {
        min-height: 80vh;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .training-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .contact-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   Foldable Device Support
   ========================================================================== */

@media screen and (spanning: single-fold-vertical) {
    .container {
        padding: 0 2rem;
    }
    
    .hero-content {
        max-width: 90%;
    }
}

/* ==========================================================================
   Reduced Motion Preferences
   ========================================================================== */

@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;
    }
    
    .error-icon,
    .spinner,
    .fa-spinner,
    .scroll-down {
        animation: none !important;
    }
    
    .service-card:hover,
    .solution-card:hover,
    .training-card:hover {
        transform: none !important;
    }
}

/* ==========================================================================
   Dark Mode Media Query
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    /* Only apply if user hasn't manually selected theme */
    :root:not([data-theme]) {
        --primary-color: #3b82f6;
        --primary-dark: #2563eb;
        --text-color: #f9fafb;
        --text-light: #d1d5db;
        --light-bg: #1f2937;
        --dark-bg: #111827;
        --white: #1f2937;
        --gray-100: #374151;
        --gray-200: #4b5563;
        --gray-300: #6b7280;
        --gray-700: #d1d5db;
        --gray-900: #f9fafb;
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --primary-dark: #0000cc;
        --secondary-color: #008000;
        --accent-color: #ff8c00;
    }
    
    .service-card,
    .solution-card,
    .training-card,
    .contact-info,
    .contact-form,
    .error-content {
        border: 2px solid #000;
    }
    
    .hero {
        background: #000;
        color: #fff;
    }
}

/* ==========================================================================
   Custom Scrollbar for Desktop
   ========================================================================== */

@media (min-width: 768px) and (pointer: fine) {
    ::-webkit-scrollbar {
        width: 12px;
    }
    
    ::-webkit-scrollbar-track {
        background: var(--light-bg);
    }
    
    ::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 6px;
        border: 3px solid var(--light-bg);
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: var(--primary-dark);
    }
}

/* ==========================================================================
   Loading Spinner Responsive Adjustments
   ========================================================================== */

@media screen and (max-width: 768px) {
    .loading-spinner {
        background-color: rgba(0, 0, 0, 0.7);
    }
    
    .spinner {
        width: 40px;
        height: 40px;
    }
}

/* ==========================================================================
   Form Validation Responsive Styles
   ========================================================================== */

@media screen and (max-width: 768px) {
    .error-message {
        position: static;
        margin-top: 0.25rem;
    }
    
    .form-message {
        margin-top: 0.75rem;
        padding: 0.75rem;
        font-size: 0.75rem;
    }
    
    .notification {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

/* ==========================================================================
   Service Cards Animation on Mobile
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    .service-card,
    .solution-card,
    .training-card {
        transition: none;
    }
    
    .service-card:active,
    .solution-card:active,
    .training-card:active {
        transform: scale(0.98);
    }
}

/* ==========================================================================
   Prevent Text Overflow
   ========================================================================== */

@media screen and (max-width: 480px) {
    .service-card h3,
    .solution-card h3,
    .training-card h3,
    .contact-info h3,
    .newsletter h3 {
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .hero h1,
    .section-header h2 {
        hyphens: auto;
        overflow-wrap: break-word;
    }
}

/* ==========================================================================
   iOS Safari Specific Fixes
   ========================================================================== */

@supports (-webkit-touch-callout: none) {
    .hero {
        min-height: -webkit-fill-available;
    }
    
    input,
    select,
    textarea {
        font-size: 16px; /* Prevent zoom on focus */
    }
}

/* ==========================================================================
   Edge Browser Specific Fixes
   ========================================================================== */

@supports (-ms-ime-align: auto) {
    .services-grid,
    .solutions-grid,
    .training-grid,
    .footer-content,
    .error-links-grid {
        display: -ms-grid;
    }
    
    .services-grid {
        -ms-grid-columns: 1fr 1fr;
    }
    
    @media (max-width: 767px) {
        .services-grid {
            -ms-grid-columns: 1fr;
        }
    }
}

/* ==========================================================================
   Responsive Typography Scale
   ========================================================================== */

@media screen and (min-width: 1600px) {
    html {
        font-size: 18px;
    }
}

@media screen and (max-width: 1024px) {
    html {
        font-size: 16px;
    }
}

@media screen and (max-width: 768px) {
    html {
        font-size: 15px;
    }
}

@media screen and (max-width: 480px) {
    html {
        font-size: 14px;
    }
}

/* ==========================================================================
   Responsive Image Handling
   ========================================================================== */

@media screen and (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
    
    .solution-icon img {
        max-width: 100px;
    }
    
    .logo img {
        height: 35px;
        width: auto;
    }
}

/* ==========================================================================
   Final Mobile Optimization
   ========================================================================== */

@media screen and (max-width: 767px) {
    /* Ensure content doesn't overflow */
    .container {
        overflow-x: hidden;
    }
    
    /* Improve touch targets */
    button,
    .cta-button,
    .lang-btn,
    .nav-menu a {
        touch-action: manipulation;
    }
    
    /* Prevent horizontal scrolling */
    body {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* Smooth transitions */
    * {
        transition: all 0.3s ease;
    }
}

/* ==========================================================================
   Print Mode Optimization
   ========================================================================== */

@media print {
    @page {
        margin: 2cm;
    }
    
    body {
        font: 12pt/1.5 "Times New Roman", Times, serif;
        color: #000;
        background: #fff;
    }
    
    a {
        text-decoration: none;
        color: #000;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 9pt;
    }
    
    .no-print {
        display: none !important;
    }
    
    .page-break {
        page-break-before: always;
    }
}