/* ========================================
   COMPLETE MOBILE APPLICATION STYLES
   Vistwin Solution - Mobile Responsive
   ======================================== */

/* ========================================
   MOBILE-FIRST BASE STYLES
   ======================================== */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --mobile-header-height: 60px;
    --mobile-nav-height: 70px;
    --mobile-padding: 16px;
    --mobile-radius: 12px;
    --touch-target-size: 44px;
}

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   MOBILE HEADER & NAVIGATION
   ======================================== */

@media (max-width: 991px) {
    /* Mobile Header */
    .topbar {
        display: none; /* Hide topbar on mobile for cleaner look */
    }
    
    .scrolling-banner {
        padding: 8px 0;
        font-size: 11px;
    }
    
    .navbar-wrapper {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: white;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        padding: 12px 0;
    }

    
    /* Mobile Logo */
    .logo {
        font-size: 20px;
        padding: 0;
    }
    
    .logo-primary,
    .logo-secondary {
        font-size: 20px;
    }
    
    .tagline {
        font-size: 8px;
        margin-top: 2px;
    }
    
    /* Mobile Menu Toggle */
    .mobile-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 32px;
        height: 32px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
    }
    
    .mobile-toggle span {
        width: 100%;
        height: 3px;
        background: linear-gradient(135deg, #667eea, #764ba2);
        border-radius: 10px;
        transition: all 0.3s ease;
        transform-origin: center;
    }
    
    .mobile-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translateY(10px);
    }
    
    .mobile-toggle.active span:nth-child(2) {
        opacity: 0;
        transform: translateX(-20px);
    }
    
    .mobile-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translateY(-10px);
    }

    
    /* Mobile Menu Slide-in */
    .navbar-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        background: white;
        flex-direction: column;
        align-items: stretch;
        padding: 80px 0 30px;
        gap: 0;
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
        transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        overflow-y: auto;
        z-index: 1000;
    }
    
    .navbar-menu.active {
        right: 0;
    }
    
    /* Mobile Menu Overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
    }
    
    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Mobile Nav Links */
    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0;
        padding: 0 20px;
    }
    
    .nav-link {
        width: 100%;
        padding: 16px 20px;
        font-size: 16px;
        border-radius: 12px;
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: all 0.3s ease;
    }
    
    .nav-link:hover,
    .nav-link.active {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        transform: translateX(5px);
    }
    
    .nav-link i {
        font-size: 18px;
    }

    
    /* Mobile Actions */
    .navbar-actions {
        flex-direction: column;
        width: 100%;
        gap: 12px;
        padding: 20px;
        border-top: 1px solid #f0f0f0;
        margin-top: 20px;
    }
    
    .btn-nav {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
        font-size: 15px;
        min-height: var(--touch-target-size);
    }
}

/* ========================================
   MOBILE HERO SECTION
   ======================================== */

@media (max-width: 768px) {
    .hero-slide {
        height: 65vh;
        min-height: 450px;
    }
    
    .hero-content {
        padding: 20px;
        text-align: center;
    }
    
    .hero-badge {
        font-size: 11px;
        padding: 8px 16px;
        margin-bottom: 16px;
    }
    
    .hero-title {
        font-size: 32px;
        line-height: 1.2;
        margin-bottom: 16px;
    }
    
    .hero-description {
        font-size: 15px;
        line-height: 1.6;
        margin-bottom: 24px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
        padding: 16px 32px;
        font-size: 15px;
        min-height: var(--touch-target-size);
    }
    
    /* Carousel Controls */
    .carousel-control-prev,
    .carousel-control-next {
        width: 44px;
        height: 44px;
        opacity: 0.9;
    }
    
    .carousel-control-prev {
        left: 10px;
    }
    
    .carousel-control-next {
        right: 10px;
    }
}

@media (max-width: 576px) {
    .hero-slide {
        height: 60vh;
        min-height: 400px;
    }
    
    .hero-title {
        font-size: 26px;
    }
    
    .hero-description {
        font-size: 14px;
    }
}


/* ========================================
   MOBILE DASHBOARD
   ======================================== */

@media (max-width: 991px) {
    .dashboard-wrapper {
        padding: 40px 0;
    }
    
    .welcome-hero {
        padding: 40px 24px;
        margin-bottom: 30px;
        border-radius: 16px;
    }
    
    .welcome-content h1 {
        font-size: 2rem;
    }
    
    .welcome-content p {
        font-size: 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 0 16px;
    }
    
    .dashboard-card {
        padding: 24px 16px;
        border-radius: 12px;
    }
    
    .card-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 16px;
    }
    
    .card-icon i {
        font-size: 2rem;
    }
    
    .dashboard-card h5 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }
    
    .dashboard-card p {
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .welcome-hero {
        padding: 30px 20px;
    }
    
    .welcome-content h1 {
        font-size: 1.75rem;
    }
    
    .info-cards {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 16px;
    }
    
    .action-buttons {
        flex-direction: column;
        padding: 0 16px;
    }
    
    .btn-dashboard {
        width: 100%;
    }
}


/* ========================================
   MOBILE TABLES & DATA DISPLAY
   ======================================== */

@media (max-width: 991px) {
    .table-section {
        padding: 20px;
        border-radius: 16px;
        margin: 0 16px;
    }
    
    .page-header {
        padding: 20px;
        flex-direction: column;
        gap: 16px;
    }
    
    .header-left h1 {
        font-size: 1.5rem;
    }
    
    .header-right {
        width: 100%;
        flex-direction: column;
    }
    
    .header-right .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Mobile Table - Card View */
    .table-responsive {
        overflow-x: visible;
    }
    
    table {
        display: block;
    }
    
    thead {
        display: none;
    }
    
    tbody {
        display: block;
    }
    
    tbody tr {
        display: block;
        background: white;
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 16px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        border: none;
    }
    
    tbody td {
        display: block;
        padding: 8px 0;
        border: none;
        text-align: left;
    }
    
    tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #667eea;
        display: block;
        margin-bottom: 4px;
        font-size: 0.85rem;
    }
    
    .user-info {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 8px;
        margin-top: 12px;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
}


/* ========================================
   MOBILE FORMS & INPUTS
   ======================================== */

@media (max-width: 768px) {
    .auth-page {
        padding: 20px 16px;
    }
    
    .auth-card {
        border-radius: 16px;
    }
    
    .card-body {
        padding: 24px 20px !important;
    }
    
    input,
    textarea,
    select,
    .form-control {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 14px 16px;
        border-radius: 12px;
        min-height: var(--touch-target-size);
    }
    
    .input-group-text {
        padding: 14px 16px;
        font-size: 16px;
    }
    
    label,
    .form-label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 8px;
    }
    
    .btn {
        min-height: var(--touch-target-size);
        padding: 14px 24px;
        font-size: 15px;
        border-radius: 12px;
    }
    
    .btn-block {
        width: 100%;
    }
    
    /* Search Box */
    .search-box {
        width: 100%;
        min-width: auto;
        margin-bottom: 16px;
    }
    
    .search-box input {
        width: 100%;
        padding: 12px 45px 12px 16px;
    }
    
    .controls-section {
        flex-direction: column;
        padding: 16px;
        gap: 12px;
    }
}


/* ========================================
   MOBILE MEDIA MANAGERS
   ======================================== */

@media (max-width: 768px) {
    /* Image/Video Manager */
    .page-header {
        margin-bottom: 24px;
    }
    
    .page-header h1 {
        font-size: 1.75rem;
    }
    
    .page-header p {
        font-size: 0.95rem;
    }
    
    .stats-bar {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 0 16px;
        margin-bottom: 24px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .stat-info h3 {
        font-size: 1.5rem;
    }
    
    .stat-info p {
        font-size: 0.85rem;
    }
    
    /* Upload Section */
    .upload-section {
        margin: 0 16px 24px;
    }
    
    .upload-card,
    .upload-section {
        padding: 24px 16px;
        border-radius: 16px;
    }
    
    .section-title {
        font-size: 1.25rem;
        margin-bottom: 20px;
    }
    
    .upload-area {
        padding: 40px 20px;
        border-radius: 12px;
    }
    
    .upload-icon {
        font-size: 3rem;
        margin-bottom: 16px;
    }
    
    .upload-area h3 {
        font-size: 1.1rem;
    }
    
    .upload-area p {
        font-size: 0.9rem;
    }
    
    /* Gallery Grid */
    .gallery-section {
        padding: 24px 16px;
        border-radius: 16px;
        margin: 0 16px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .image-card,
    .video-card {
        border-radius: 12px;
    }
    
    .image-container,
    .video-container {
        height: 150px;
    }
    
    .image-info,
    .video-info {
        padding: 12px;
    }
    
    .image-name,
    .video-name {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    .image-meta,
    .video-meta {
        font-size: 0.75rem;
        flex-direction: column;
        gap: 4px;
    }
    
    .image-actions,
    .video-actions {
        flex-direction: column;
        gap: 6px;
    }
    
    .action-btn {
        padding: 8px;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .image-container,
    .video-container {
        height: 200px;
    }
}


/* ========================================
   MOBILE DOCUMENT MANAGER
   ======================================== */

@media (max-width: 768px) {
    .document-page-header {
        padding: 50px 0 30px;
    }
    
    .header-icon {
        width: 70px;
        height: 70px;
    }
    
    .header-icon i {
        font-size: 2rem;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .header-content p {
        font-size: 1rem;
    }
    
    .document-manager-wrapper {
        padding: 30px 0;
    }
    
    .upload-card {
        padding: 30px 20px;
        margin: 0 16px;
    }
    
    .upload-header h3 {
        font-size: 1.5rem;
    }
    
    .upload-icon {
        width: 60px;
        height: 60px;
    }
    
    .upload-icon i {
        font-size: 2rem;
    }
    
    .file-label {
        padding: 40px 20px;
    }
    
    .file-label-content i {
        font-size: 2.5rem;
    }
    
    .file-label-text {
        font-size: 1rem;
    }
    
    .supported-formats {
        padding: 16px;
    }
    
    .format-tags {
        gap: 8px;
    }
    
    .format-tag {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    .documents-section {
        margin: 0 16px;
        padding: 24px 16px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .section-title h2 {
        font-size: 1.5rem;
    }
    
    .documents-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .document-card {
        border-radius: 12px;
    }
    
    .document-preview {
        padding: 30px 20px;
    }
    
    .file-icon-wrapper {
        width: 80px;
        height: 80px;
    }
    
    .file-icon-wrapper i {
        font-size: 2.5rem;
    }
    
    .document-info {
        padding: 16px;
    }
    
    .document-actions {
        flex-direction: column;
    }
    
    .action-btn {
        padding: 12px;
        border-right: none !important;
    }
    
    .action-btn:not(:last-child) {
        border-bottom: 1px solid #f3f4f6;
    }
}


/* ========================================
   MOBILE MODALS
   ======================================== */

@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-width: 100%;
        width: 100%;
        margin: 0;
        border-radius: 16px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
        top: 15px;
        right: 15px;
    }
    
    .modal h2 {
        font-size: 1.5rem;
    }
    
    .modal input,
    .modal textarea,
    .modal select {
        font-size: 16px !important;
        padding: 12px 16px;
    }
}

/* ========================================
   MOBILE PAGINATION
   ======================================== */

@media (max-width: 768px) {
    .pagination {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination a,
    .pagination span {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-width: 36px;
        text-align: center;
    }
    
    /* Hide middle page numbers on mobile */
    .pagination .page-item:not(.active):not(:first-child):not(:last-child):not(:nth-child(2)):not(:nth-last-child(2)) {
        display: none;
    }
}

/* ========================================
   MOBILE FOOTER
   ======================================== */

@media (max-width: 768px) {
    footer {
        padding: 30px 20px !important;
    }
    
    footer .row > div {
        margin-bottom: 24px;
    }
    
    footer h6 {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    footer p,
    footer a,
    footer li {
        font-size: 0.85rem;
    }
    
    .back-to-top {
        width: 50px !important;
        height: 50px !important;
        font-size: 18px !important;
        bottom: 20px !important;
        right: 20px !important;
    }
}


/* ========================================
   MOBILE TOUCH OPTIMIZATIONS
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .feature-card-ultra:hover .feature-card-inner,
    .service-card:hover,
    .client-card-ultra:hover .card-inner,
    .dashboard-card:hover,
    .image-card:hover,
    .video-card:hover,
    .document-card:hover {
        transform: none;
    }
    
    /* Increase tap targets */
    .btn,
    .filter-btn,
    .nav-link,
    .action-btn,
    button {
        min-height: var(--touch-target-size);
        min-width: var(--touch-target-size);
    }
    
    /* Better touch feedback */
    .btn:active,
    .filter-btn:active,
    .nav-link:active,
    .action-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Remove complex 3D transforms on mobile */
    .card-inner {
        transform-style: flat;
    }
}

/* ========================================
   MOBILE SWIPE GESTURES
   ======================================== */

@media (max-width: 768px) {
    .carousel-inner,
    .gallery-grid,
    .documents-grid {
        touch-action: pan-y pinch-zoom;
    }
    
    /* Smooth scrolling */
    .table-responsive,
    .gallery-section,
    .documents-section {
        -webkit-overflow-scrolling: touch;
    }
}

/* ========================================
   MOBILE LOADING STATES
   ======================================== */

@media (max-width: 768px) {
    .loading-spinner {
        width: 40px;
        height: 40px;
        margin: 20px auto;
    }
    
    .skeleton-loader {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: loading 1.5s infinite;
        border-radius: 8px;
    }
    
    @keyframes loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
}

/* ========================================
   MOBILE NOTIFICATIONS
   ======================================== */

@media (max-width: 768px) {
    .notification,
    .toast,
    .custom-alert {
        width: calc(100% - 32px);
        max-width: 100%;
        margin: 16px;
        border-radius: 12px;
        font-size: 14px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }
    
    .alert-icon {
        width: 40px;
        height: 40px;
    }
    
    .alert-icon i {
        font-size: 1.25rem;
    }
}


/* ========================================
   MOBILE SAFE AREA INSETS (iPhone X+)
   ======================================== */

@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .navbar-wrapper {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    
    .navbar-menu {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(30px, env(safe-area-inset-bottom));
    }
    
    .hero-content,
    footer {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    
    .back-to-top {
        bottom: max(20px, env(safe-area-inset-bottom));
        right: max(20px, env(safe-area-inset-right));
    }
}

/* ========================================
   MOBILE LANDSCAPE MODE
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .hero-slide {
        height: 100vh;
        min-height: 400px;
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .hero-description {
        font-size: 14px;
    }
    
    .navbar-menu {
        width: 60%;
        max-width: 400px;
    }
}

/* ========================================
   SMALL MOBILE (320px - 375px)
   ======================================== */

@media (max-width: 375px) {
    :root {
        --mobile-padding: 12px;
    }
    
    .hero-title {
        font-size: 24px;
    }
    
    .features-title,
    .clients-title,
    .section-title h2 {
        font-size: 1.25rem;
    }
    
    .hero-buttons .btn {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .dashboard-card {
        padding: 20px 12px;
    }
    
    .card-icon {
        width: 50px;
        height: 50px;
    }
    
    .card-icon i {
        font-size: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

/* ========================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
    /* Reduce animations on mobile */
    * {
        animation-duration: 0.3s !important;
    }
    
    /* Simplify gradients on mobile */
    .hero-overlay {
        background: rgba(139, 92, 246, 0.85) !important;
    }
    
    /* Reduce blur effects */
    .feature-orb,
    .gradient-orb,
    .floating-shape {
        filter: blur(30px) !important;
        opacity: 0.5;
    }
    
    /* Hide decorative elements on mobile */
    .floating-shapes {
        display: none;
    }
}


/* ========================================
   MOBILE ACCESSIBILITY
   ======================================== */

@media (max-width: 768px) {
    /* Larger focus indicators */
    *:focus {
        outline: 3px solid #667eea;
        outline-offset: 2px;
    }
    
    /* Better contrast for small screens */
    .hero-description,
    .feature-desc-ultra,
    .clients-subtitle {
        color: rgba(255, 255, 255, 0.95);
        text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }
    
    /* Skip to content link */
    .skip-to-content {
        position: absolute;
        top: -40px;
        left: 0;
        background: #667eea;
        color: white;
        padding: 8px 16px;
        text-decoration: none;
        z-index: 10000;
    }
    
    .skip-to-content:focus {
        top: 0;
    }
}

/* ========================================
   REDUCED MOTION (Accessibility)
   ======================================== */

@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;
    }
}

/* ========================================
   HIGH CONTRAST MODE (Accessibility)
   ======================================== */

@media (prefers-contrast: high) {
    .btn,
    .card,
    .feature-card-inner,
    .dashboard-card,
    .document-card {
        border: 2px solid currentColor;
    }
    
    .nav-link:hover,
    .nav-link.active {
        border: 2px solid white;
    }
}

/* ========================================
   DARK MODE SUPPORT (Mobile)
   ======================================== */

@media (max-width: 768px) and (prefers-color-scheme: dark) {
    body {
        background: #1a1a2e;
        color: #ffffff;
    }
    
    .navbar-wrapper {
        background: #16213e;
        box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    }
    
    .navbar-menu {
        background: #16213e;
    }
    
    .card,
    .dashboard-card,
    .upload-card,
    .document-card {
        background: #0f3460;
        color: #ffffff;
    }
    
    input,
    textarea,
    select {
        background: #16213e;
        color: #ffffff;
        border-color: #533483;
    }
}

/* ========================================
   MOBILE PRINT STYLES
   ======================================== */

@media print {
    .navbar,
    .mobile-toggle,
    .back-to-top,
    .floating-shapes,
    .navbar-menu,
    .mobile-menu-overlay,
    .action-buttons,
    .btn {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        background: white;
    }
    
    .container {
        max-width: 100%;
    }
}

/* ========================================
   END OF MOBILE APP STYLES
   ======================================== */
