/* ===== CASA DOS BORDADOS - MOBILE OPTIMIZATIONS ===== */

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

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

/* Mobile table improvements */
@media (max-width: 767.98px) {
    /* Table cards para mobile */
    .table-responsive {
        border: none !important;
        padding: 0;
    }
    
    .mobile-table-cards .table {
        display: none;
    }
    
    .mobile-table-card {
        background: white;
        border-radius: 0.5rem;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        margin-bottom: 1rem;
        padding: 1rem;
        border-left: 4px solid var(--bs-primary);
    }
    
    .mobile-table-card .card-title {
        font-size: 1.1rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: var(--bs-dark);
    }
    
    .mobile-table-card .card-text {
        margin-bottom: 0.25rem;
        font-size: 0.9rem;
    }
    
    .mobile-table-card .card-text strong {
        color: var(--bs-dark);
        min-width: 80px;
        display: inline-block;
    }
    
    .mobile-table-card .card-actions {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--bs-light);
    }
    
    /* Status badges mobile */
    .badge {
        font-size: 0.8rem !important;
        padding: 0.375rem 0.75rem !important;
    }
    
    /* Form improvements mobile */
    .form-floating label {
        font-size: 0.9rem;
        padding-left: 1rem;
    }
    
    .form-floating input {
        height: 3.5rem;
        font-size: 1rem;
    }
    
    /* Button groups mobile */
    .btn-group {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.5rem;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Dropdown mobile */
    .dropdown-menu {
        border: none;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
        border-radius: 0.75rem;
        padding: 0.5rem;
    }
    
    .dropdown-item {
        border-radius: 0.5rem;
        padding: 0.75rem 1rem;
        margin-bottom: 0.25rem;
    }
    
    .dropdown-item:last-child {
        margin-bottom: 0;
    }
    
    /* Modal mobile */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-header {
        padding: 1rem 1.25rem;
        border-bottom: 1px solid var(--bs-border-color);
    }
    
    .modal-body {
        padding: 1.25rem;
    }
    
    .modal-footer {
        padding: 1rem 1.25rem;
        border-top: 1px solid var(--bs-border-color);
        justify-content: stretch;
    }
    
    .modal-footer .btn {
        flex: 1;
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }
    
    .modal-footer .btn:first-child {
        margin-left: 0;
    }
    
    .modal-footer .btn:last-child {
        margin-right: 0;
    }
    
    /* Navigation improvements */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .nav-tabs .nav-link {
        white-space: nowrap;
        min-width: auto;
        padding: 0.75rem 1rem;
    }
    
    /* Search and filter improvements */
    .search-wrapper {
        position: relative;
    }
    
    .search-wrapper .form-control {
        padding-right: 2.5rem;
    }
    
    .search-wrapper .search-icon {
        position: absolute;
        right: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--bs-secondary);
        pointer-events: none;
    }
    
    /* Pagination mobile */
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .page-item .page-link {
        min-width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0.125rem;
        border-radius: 0.5rem;
    }
    
    /* Toast mobile */
    .toast-container {
        position: fixed !important;
        top: auto !important;
        bottom: 1rem !important;
        left: 1rem !important;
        right: 1rem !important;
        z-index: 1080 !important;
    }
    
    .toast {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }
    
    /* Print mobile */
    .mobile-print-btn {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        z-index: 1000;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    }
    
    /* ===== CATALOG MOBILE OPTIMIZATIONS - NEW STRUCTURE ===== */
    
    /* Mobile Catalog Card */
    .catalog-card-mobile {
        background: white;
        border-radius: 1rem;
        overflow: hidden;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .catalog-card-mobile:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    }
    
    /* Mobile Image Container - ALWAYS AT TOP */
    .mobile-image-container {
        width: 100%;
        height: 200px;
        overflow: hidden;
        position: relative;
        background-color: #f8f9fa;
        display: flex;
        align-items: center;
        justify-content: center;
        border-bottom: 1px solid #dee2e6;
        flex-shrink: 0;
    }
    
    /* Mobile Catalog Image */
    .mobile-catalog-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
    }
    
    /* Mobile No Image Placeholder */
    .mobile-no-image {
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        color: #6c757d;
    }
    
    .mobile-no-image i {
        font-size: 3rem;
        opacity: 0.5;
    }
    
    /* Mobile Card Content */
    .mobile-card-content {
        padding: 1rem;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }
    
    /* Mobile Card Title */
    .mobile-card-title {
        font-size: 1.1rem;
        font-weight: 600;
        margin-bottom: 0.75rem;
        color: #212529;
        line-height: 1.3;
    }
    
    /* Mobile Card Info */
    .mobile-card-info {
        margin-bottom: 1rem;
        flex-grow: 1;
    }
    
    .mobile-card-info .text-muted {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    .mobile-card-info i {
        width: 16px;
        text-align: center;
        margin-right: 0.5rem;
        color: #0066cc;
    }
    
    /* Mobile Card Actions */
    .mobile-card-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: auto;
    }
    
    /* Mobile Buttons */
    .mobile-btn {
        min-height: 44px;
        border-radius: 0.5rem;
        font-weight: 500;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        transition: all 0.2s ease;
        font-size: 0.9rem;
    }
    
    .mobile-btn i {
        font-size: 0.9rem;
    }
    
    /* Mobile button hover effects */
    .mobile-btn.btn-success:hover {
        background-color: #157347;
        border-color: #146c43;
        transform: translateY(-1px);
    }
    
    .mobile-btn.btn-info:hover {
        background-color: #31d2f2;
        border-color: #25cff2;
        transform: translateY(-1px);
    }
}

/* Landscape mobile optimizations */
@media (max-width: 767.98px) and (orientation: landscape) {
    .navbar {
        padding: 0.25rem 1rem;
    }
    
    .sidebar {
        width: 320px;
    }
    
    .modal-dialog {
        max-height: calc(100vh - 1rem);
        margin: 0.5rem auto;
    }
    
    .modal-content {
        max-height: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        overflow-y: auto;
        flex: 1;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar-backdrop,
    .loading::after {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--bs-border-color) !important;
    }
    
    .btn {
        border-width: 2px !important;
    }
}

/* Focus improvements for keyboard navigation */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
    border-color: #86b7fe !important;
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    /* Larger touch targets */
    .btn-sm {
        min-height: 44px !important;
        padding: 0.5rem 1rem !important;
    }
    
    .form-check-input {
        width: 1.25rem !important;
        height: 1.25rem !important;
    }
    
    .form-switch .form-check-input {
        width: 2.5rem !important;
        height: 1.25rem !important;
    }
}