/* COMPREHENSIVE MOBILE RESPONSIVE DESIGN FOR SEQUINSWAG */

/* Large tablets and small desktops */
@media (max-width: 992px) {
    .hero-circles {
        height: 400px;
    }

    .circle-large {
        width: 150px;
        height: 150px;
    }

    .circle-medium {
        width: 120px;
        height: 120px;
    }

    .circle-small {
        width: 90px;
        height: 90px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .admin-content .container-fluid {
        padding: 1rem;
    }
}

/* Tablets */
@media (max-width: 768px) {
    /* Navigation */
    .navbar-brand img {
        height: 45px !important;
        width: 45px !important;
        object-fit: contain !important;
    }

    .navbar-collapse {
        margin-top: 1rem;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding-top: 1rem;
    }

    .cart-total {
        display: none; /* Hide cart total text on mobile */
    }

    .search-form {
        width: 100% !important;
        margin-bottom: 1rem;
    }

    .search-form input {
        width: 100% !important;
    }

    /* Hero sections */
    .bubble-hero-title,
    .hero-main-title {
        font-size: 2.5rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .bubble-hero-description,
    .hero-subtitle {
        font-size: 1.1rem !important;
        margin-bottom: 1.5rem;
    }

    .bubble-hero-buttons,
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    .bubble-hero-buttons .btn,
    .hero-buttons .btn {
        width: 250px;
    }

    /* Model bubbles */
    .model-bubble-container img {
        width: 200px !important;
        height: 200px !important;
    }

    .model-bubble-container div {
        width: 160px !important;
        height: 160px !important;
    }

    /* Categories */
    .category-exact-item .category-image-container {
        width: 120px !important;
        height: 120px !important;
        margin: 0 auto 0.75rem;
    }

    .category-icon-circle {
        width: 60px !important;
        height: 60px !important;
    }

    .category-icon-circle i {
        font-size: 1.5rem !important;
    }

    /* Product cards */
    .product-card,
    .product-card-psd,
    .product-item {
        margin-bottom: 1.5rem;
    }

    .product-image-container {
        height: 200px;
    }

    .product-title {
        font-size: 1rem;
        height: auto;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }

    .product-price {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    /* Product details page */
    .product-gallery .carousel-inner {
        height: 300px;
    }

    .thumbnail-images {
        justify-content: center;
        gap: 0.25rem;
    }

    .thumbnail {
        width: 60px;
        height: 60px;
    }

    .product-details {
        margin-top: 1rem;
        text-align: center;
    }

    /* Forms */
    .quantity-controls {
        justify-content: center;
        margin: 1rem 0;
    }

    .product-actions {
        gap: 0.75rem;
        flex-direction: column;
    }

    .product-actions .btn {
        padding: 0.75rem 1rem;
        width: 100%;
    }

    .variation-select {
        text-align: center;
    }

    /* Cart */
    .cart-item {
        padding: 1rem 0.5rem;
        text-align: center;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        background: #f8f9fa;
    }

    .cart-item .row {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .cart-item .col-md-2,
    .cart-item .col-md-4,
    .cart-item .col-md-3,
    .cart-item .col-md-1 {
        width: 100%;
        max-width: none;
        text-align: center;
    }

    .design-thumbnail {
        display: flex;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .shipping-options {
        margin: 1.5rem 0;
    }

    .shipping-options .form-check {
        margin-bottom: 1rem;
        padding: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        background: #fff;
    }

    /* Checkout */
    .checkout-form .row > div {
        margin-bottom: 1rem;
    }

    .order-summary {
        margin-top: 2rem;
        position: static !important;
    }

    .payment-methods .form-check {
        padding: 1rem;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
    }

    /* Admin interface */
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
        width: 280px;
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-content {
        margin-left: 0 !important;
        padding: 0.5rem;
    }

    .stat-card {
        margin-bottom: 1rem;
        text-align: center;
        padding: 1.5rem 1rem;
    }

    .stat-card .fa-3x {
        font-size: 2.5rem !important;
    }

    .admin-header {
        padding: 0.75rem 0;
    }

    .admin-header .container-fluid {
        padding: 0 1rem;
    }

    /* Tables */
    .table-responsive {
        font-size: 0.85rem;
        border-radius: 0.5rem;
        overflow: auto;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
        min-width: 100px;
    }

    .table th:first-child,
    .table td:first-child {
        position: sticky;
        left: 0;
        background: white;
        z-index: 1;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.25rem;
        padding: 0.5rem 1rem;
    }

    .dropdown-menu {
        position: static !important;
        transform: none !important;
        width: 100%;
        margin-top: 0.5rem;
        border-radius: 0.5rem;
    }
}

/* Small mobile devices */
@media (max-width: 576px) {
    /* Extra compact navigation */
    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand img {
        height: 35px !important;
        width: 35px !important;
        object-fit: contain !important;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        text-align: center;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        transition: all 0.3s ease;
    }

    .navbar-nav .nav-link:hover {
        background-color: rgba(255,255,255,0.1);
        color: #ffc107;
    }

    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }

    /* Optimize for 7 navigation items */
    .navbar-nav {
        width: 100%;
    }

    @media (max-width: 991px) {
        .navbar-nav .nav-link {
            padding: 0.875rem 1rem;
            font-size: 1.1rem;
            font-weight: 500;
        }

        .navbar-collapse {
            margin-top: 1rem;
            padding-top: 1rem;
            border-top: 2px solid rgba(255,255,255,0.2);
            background: rgba(0,0,0,0.1);
            border-radius: 0.5rem;
            margin: 1rem -1rem 0;
            padding: 1rem;
        }
    }

    /* Hero sections */
    .bubble-hero-psd {
        min-height: 500px;
        padding: 2rem 0;
    }

    .bubble-hero-title,
    .hero-main-title {
        font-size: 1.8rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .section-title {
        font-size: 1.5rem !important;
        text-align: center;
    }

    .section-title-script {
        font-size: 1.7rem !important;
    }

    /* Model bubbles very compact */
    .model-bubble-container {
        margin-bottom: 1rem;
    }

    .model-bubble-container img {
        width: 150px !important;
        height: 150px !important;
    }

    .model-bubble-container div {
        width: 130px !important;
        height: 130px !important;
    }

    /* Categories */
    .categories-exact-psd .row {
        justify-content: center;
    }

    .category-exact-item {
        margin-bottom: 1.5rem;
    }

    .category-exact-item .category-image-container {
        width: 100px !important;
        height: 100px !important;
        margin: 0 auto 0.75rem;
    }

    /* Product listings */
    .product-grid,
    .products-container {
        grid-template-columns: 1fr !important;
    }

    .product-image-container {
        height: 200px;
    }

    .product-content,
    .product-info {
        padding: 1rem;
        text-align: center;
    }

    /* Product details */
    .product-details {
        margin-top: 1.5rem;
        padding: 1rem;
        text-align: center;
    }

    .product-form {
        background: #f8f9fa;
        padding: 1.5rem;
        border-radius: 0.5rem;
        margin: 1rem 0;
    }

    .variation-select {
        text-align: center;
        margin-bottom: 1rem;
    }

    /* Compact forms */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 44px;
        border-radius: 0.5rem;
    }

    .btn-lg {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        min-height: 50px;
    }

    /* Search and filters */
    .search-form {
        margin-bottom: 1rem;
    }

    .search-form input {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }

    .filter-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }

    /* Cart mobile optimization */
    .cart-summary {
        position: static !important;
        margin-top: 2rem;
        width: 100%;
    }

    .quantity-controls {
        justify-content: center;
        gap: 0.5rem;
    }

    .quantity-controls input {
        width: 60px !important;
        text-align: center;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }

    .pagination .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        margin: 0.125rem;
        border-radius: 0.375rem;
    }

    /* Modals for mobile */
    .modal-dialog {
        margin: 0.25rem;
        width: calc(100% - 0.5rem);
        max-width: none;
    }

    .modal-header,
    .modal-footer {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }

    /* Bulk sizing modal */
    .bulk-size-options {
        gap: 0.75rem;
    }

    .bulk-size-options .col-md-4 {
        margin-bottom: 1rem;
    }

    .size-card {
        padding: 1rem;
        text-align: center;
    }

    .quantity-controls button {
        width: 40px;
        height: 40px;
        border-radius: 0.375rem;
    }

    /* Footer improvements */
    .footer {
        text-align: center;
    }

    .footer .row > div {
        margin-bottom: 1.5rem;
    }

    .newsletter-form {
        flex-direction: column;
        gap: 0.75rem;
    }

    .newsletter-form input,
    .newsletter-form button {
        width: 100%;
    }

    .social-links {
        justify-content: center;
        gap: 1rem;
    }

    /* Admin mobile */
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
        width: 280px;
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-content {
        margin-left: 0 !important;
        padding: 0.5rem;
    }

    .stat-card {
        margin-bottom: 1rem;
        text-align: center;
        padding: 1.5rem 1rem;
    }

    .stat-card .fa-3x {
        font-size: 2.5rem !important;
    }

    .admin-header {
        padding: 0.75rem 0;
    }

    .admin-header .container-fluid {
        padding: 0 1rem;
    }

    .admin-header h1 {
        font-size: 1.3rem;
    }

    /* Tables horizontal scroll */
    .table-responsive {
        border-radius: 0.5rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .table {
        font-size: 0.85rem;
        margin-bottom: 0;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
        min-width: 120px;
        vertical-align: middle;
    }

    .table th:first-child,
    .table td:first-child {
        position: sticky;
        left: 0;
        background: white;
        z-index: 2;
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    }

    .table thead th {
        position: sticky;
        top: 0;
        background: #f8f9fa;
        z-index: 1;
    }

    .order-status-badge,
    .badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Small mobile devices */
@media (max-width: 576px) {
    /* Extra compact everything */
    .container,
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Navigation ultra-compact */
    .navbar {
        padding: 0.5rem 0.75rem;
    }

    .navbar-brand img {
        height: 30px !important;
        width: 30px !important;
        object-fit: contain !important;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 0;
        font-size: 1.05rem;
    }

    /* Hero ultra-compact */
    .bubble-hero-psd {
        min-height: 450px;
        padding: 1.5rem 0;
    }

    .bubble-hero-title {
        font-size: 1.6rem !important;
        line-height: 1.2;
    }

    .bubble-hero-description {
        font-size: 1rem !important;
    }

    .bubble-hero-buttons .btn {
        width: 200px;
        padding: 0.75rem 1rem;
    }

    /* Model bubbles smallest */
    .model-bubble-container img {
        width: 120px !important;
        height: 120px !important;
    }

    .model-bubble-container div {
        width: 100px !important;
        height: 100px !important;
    }

    /* Categories ultra-compact */
    .category-exact-item .category-image-container {
        width: 80px !important;
        height: 80px !important;
    }

    .category-exact-item h5 {
        font-size: 0.9rem;
    }

    .category-exact-item .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

    /* Product cards single column */
    .products-container .row {
        margin: 0;
    }

    .product-item {
        padding: 0;
        margin-bottom: 1rem;
    }

    .product-image-container {
        height: 180px;
    }

    /* Forms ultra-compact */
    .form-control {
        font-size: 16px;
        padding: 0.75rem;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        border-radius: 0.5rem;
    }

    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Cart ultra-mobile */
    .cart-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .cart-item img {
        width: 60px !important;
        height: 60px !important;
    }

    .design-thumbnail img {
        width: 35px !important;
        height: 35px !important;
    }

    /* Tables ultra-compact */
    .table {
        font-size: 0.8rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        min-width: 100px;
    }

    .table th:first-child,
    .table td:first-child {
        min-width: 80px;
    }

    /* Modals full-screen on small devices */
    .modal-dialog {
        margin: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
    }

    .modal-content {
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 1rem;
    }

    /* Bulk sizing ultra-compact */
    .bulk-size-options .col-md-4 {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .size-card {
        padding: 0.75rem;
    }

    .size-card h6 {
        font-size: 1rem;
    }

    .quantity-controls {
        gap: 0.5rem;
    }

    .quantity-controls button {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .quantity-controls input {
        width: 50px;
        height: 35px;
        font-size: 0.9rem;
    }

    /* Footer ultra-compact */
    .footer {
        padding: 2rem 0;
    }

    .footer .row > div {
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .footer h5,
    .footer h6 {
        font-size: 1rem;
    }

    .footer ul {
        columns: 1;
    }

    .footer li {
        margin-bottom: 0.5rem;
    }

    /* Admin ultra-mobile */
    .admin-sidebar {
        width: 100%;
    }

    .admin-header h1 {
        font-size: 1.1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card h3 {
        font-size: 1.3rem;
    }

    .stat-card .fa-3x {
        font-size: 2rem !important;
    }

    .card-body {
        padding: 1rem;
    }

    .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Ensure all interactive elements are touch-friendly */
    .btn,
    .form-control,
    .nav-link,
    .dropdown-item,
    .tool-btn,
    .thumbnail-nav {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }

    /* Remove hover effects that don't work on touch */
    .product-card:hover,
    .category-card:hover,
    .btn:hover,
    .tool-btn:hover {
        transform: none !important;
        box-shadow: inherit !important;
    }

    /* Make tap targets larger and more finger-friendly */
    .tool-btn {
        min-width: 50px;
        min-height: 50px;
        margin: 0.125rem;
    }

    .thumbnail-nav {
        min-width: 50px;
        min-height: 50px;
        margin: 0.125rem;
    }

    .quantity-controls button {
        min-width: 44px;
        min-height: 44px;
    }

    /* Improve scrolling */
    .designer-toolbar,
    .properties-panel,
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow: auto;
    }

    /* Focus states for touch */
    .form-control:focus,
    .btn:focus {
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
        outline: none;
    }

    /* Card interactions */
    .product-card,
    .category-card {
        cursor: pointer;
        transition: background-color 0.2s ease;
    }

    .product-card:active,
    .category-card:active {
        background-color: #f8f9fa;
    }
}

/* Landscape mobile optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .bubble-hero-psd {
        min-height: 400px;
    }

    .hero-content {
        padding: 1rem 0;
    }

    .model-bubble-container img {
        width: 160px !important;
        height: 160px !important;
    }

    .model-bubble-container div {
        width: 140px !important;
        height: 140px !important;
    }

    /* Design tool landscape mode */
    .designer-content {
        grid-template-columns: 180px 1fr 200px !important;
        grid-template-rows: 1fr !important;
        height: calc(100vh - 120px);
    }

    .designer-toolbar {
        flex-direction: column !important;
        height: auto !important;
        border-right: 1px solid #e5e7eb !important;
        border-bottom: none !important;
        overflow-y: auto;
    }

    .properties-panel {
        border-top: none !important;
        border-left: 1px solid #e5e7eb !important;
        height: auto !important;
    }

    #design-canvas {
        max-height: calc(100vh - 180px);
    }
}

/* High DPI displays (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img,
    .product-image,
    .category-image,
    .hero-model img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    /* Sharper borders and shadows on retina */
    .card,
    .btn,
    .form-control {
        border-width: 0.5px;
    }

    .shadow,
    .shadow-sm {
        box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    }
}

/* Light mode support (force light theme even in dark mode preference) */
@media (prefers-color-scheme: dark) {
    .card {
        background-color: #ffffff !important;
        border-color: #e2e8f0 !important;
        color: #333333 !important;
    }

    .bg-light {
        background-color: #f8f9fa !important;
    }

    .text-muted {
        color: #6c757d !important;
    }

    /* Force all backgrounds to light */
    body, html {
        background-color: #ffffff !important;
        color: #333333 !important;
    }

    .navbar, footer {
        background-color: #ffffff !important;
        color: #333333 !important;
    }
}

/* Reduced 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;
    }

    .hero-model,
    .model-bubble-container {
        animation: none !important;
    }
}

/* Print optimizations */
@media print {
    .navbar,
    .footer,
    .btn,
    .admin-sidebar,
    .modal {
        display: none !important;
    }

    .admin-content {
        margin-left: 0 !important;
    }

    .container,
    .container-fluid {
        max-width: 100% !important;
        padding: 0;
    }

    .card {
        break-inside: avoid;
        border: 1px solid #000;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}