/* layout.css - Layout and responsive styles */

/* ========== FULLSCREEN LOADING OVERLAY ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 20, 25, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Safari */
    z-index: var(--z-loading-overlay);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.loading-overlay.active {
    display: flex;
    opacity: 1;
}

.loading-content {
    text-align: center;
    max-width: 400px;
    padding: 2.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.loading-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 2rem;
    animation: logoPulse 2s infinite ease-in-out;
}

.loading-progress {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.loading-progress-bar {
    height: 100%;
    background: var(--gradient-gold);
    width: 0%;
    border-radius: 3px;
    transition: width 0.3s ease;
    animation: progressAnimation 2s infinite ease-in-out;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 1rem;
    font-weight: 500;
}

.loading-tab-name {
    color: var(--accent-gold);
    font-weight: 600;
    text-transform: capitalize;
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-toast);
    transform: translateX(100%);
    opacity: 0;
    transition: var(--transition-slow);
    max-width: 350px;
    border-left: 4px solid var(--accent-gold);
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left-color: var(--success);
}

.toast-warning {
    border-left-color: var(--warning);
}

.toast-error {
    border-left-color: var(--danger);
}

.toast-content {
    display: flex;
    align-items: center;
    color: var(--text-primary);
    gap: 0.75rem;
}

.toast-content i {
    font-size: 1.25rem;
}

/* ========== IMAGE GALLERY ========== */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.image-gallery-item {
    width: 100%;
    height: 120px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-medium);
    border: 2px solid transparent;
}

.image-gallery-item:hover {
    transform: scale(1.05);
    border-color: var(--accent-gold);
    box-shadow: 0 8px 20px rgba(251, 191, 36, 0.2);
}

.image-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========== OFFLINE INDICATOR ========== */
.offline .language-selector {
    background: linear-gradient(to right, var(--warning), var(--danger));
}

.offline::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--warning), var(--danger));
    z-index: var(--z-tooltip);
    animation: pulse 2s infinite;
}

/* ========== RESPONSIVE DESIGN ========== */

/* Mobile devices (up to 768px) */
@media (max-width: 768px) {
    /* Header improvements */
    .language-selector {
        height: 50px;
        padding: 0 0.75rem;
    }
    
    .logo-img {
        height: 26px;
    }
    
    .language-label {
        display: none;
    }
    
    .language-wrapper {
        font-size: 0.8rem;
    }
    
    .language-select {
        min-width: 100px;
        padding: 0.375rem 1.5rem 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Stats cards - 2 per row */
    .header-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .stat-card {
        padding: 0.75rem;
        min-height: 70px;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    /* ========== FIXED MOBILE TABS ========== */
    .tab-container {
        margin-bottom: 1rem;
        padding: 0.375rem;
        border-radius: var(--radius-md);
    }
    
    .tab-navigation {
        gap: 0.25rem;
    }
    
    .tab-btn {
        flex: 1 0 calc(33.333% - 0.25rem);
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
        min-height: 65px;
        gap: 0.25rem;
        flex-direction: column;
        border-radius: var(--radius-sm);
        margin-bottom: 0.25rem;
    }
    
    /* Last two tabs (4th and 5th) take 50% width each */
    .tab-btn:nth-child(4),
    .tab-btn:nth-child(5) {
        flex: 1 0 calc(50% - 0.25rem);
    }
    
    .tab-btn .fas {
        font-size: 0.9rem;
        margin-bottom: 0.125rem;
    }
    
    .tab-btn .tab-text {
        font-size: 0.65rem;
        line-height: 1.1;
        display: block;
        white-space: normal;
        word-wrap: break-word;
        max-height: 2.2em;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Active state */
    .tab-btn.active::before {
        height: 2px;
        top: -0.25rem;
    }
    
    /* ========== COMPACT COLLAPSIBLE FILTER PANEL ========== */
    .filter-panel {
        padding: 0.75rem;
        margin-bottom: 1rem;
        border-radius: var(--radius-sm);
        max-height: 50px; /* Collapsed height on mobile */
    }
    
    .filter-panel.expanded {
        max-height: 600px;
    }
    
    .filter-header {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }
    
    .filter-header h6 {
        font-size: 0.9rem;
    }
    
    .filter-content {
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
        margin-top: 1rem;
    }
    
    .filter-panel.collapsed .filter-content {
        border-top: none;
        margin-top: 0;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .filter-group {
        margin-bottom: 0.5rem;
    }
    
    .filter-group .form-label {
        font-size: 0.8rem;
        margin-bottom: 0.375rem;
    }
    
    .filter-group .form-control,
    .filter-group .form-select {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
        height: 40px;
        border-radius: var(--radius-sm);
    }
    
    /* Placeholder on mobile */
    .filter-group .form-control::placeholder,
    .filter-group .form-select::placeholder {
        font-size: 0.85rem;
    }
    
    .filter-panel .btn {
        padding: 0.75rem;
        font-size: 0.85rem;
        min-height: 42px;
        margin-top: 0.5rem;
    }
    
    /* Cards - full width */
    .orders-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .order-card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }
    
    .order-card:hover {
        transform: translateY(-2px);
    }
    
    .order-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .detail-label {
        font-size: 0.7rem;
    }
    
    .detail-value {
        font-size: 0.85rem;
    }
    
    /* Status badges */
    .status-badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.65rem;
        min-height: 22px;
    }
    
    /* Modal improvements */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: var(--radius-md);
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding: 1rem;
    }
    
    .modal-header h5 {
        font-size: 1rem;
    }
    
    /* Modal placeholder on mobile */
    .modal-body .form-control::placeholder,
    .modal-body .form-select::placeholder,
    .modal-body textarea::placeholder {
        font-size: 0.9rem;
    }
    
    /* FAB */
    .fab {
        width: 50px;
        height: 50px;
        bottom: 1rem;
        right: 1rem;
        font-size: 1.1rem;
    }
    
    /* Image preview */
    .image-preview {
        gap: 6px;
    }
    
    .image-preview-item {
        width: 60px;
        height: 60px;
    }
    
    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Better spacing */
    .main-content {
        padding-bottom: 4rem;
    }
    
    /* Loading overlay */
    .loading-content {
        padding: 1rem;
        max-width: 280px;
        margin: 0.5rem;
    }
    
    .loading-logo {
        width: 50px;
        height: 50px;
        margin-bottom: 1rem;
    }
    
    .loading-text {
        font-size: 0.85rem;
    }
    
    /* Results info */
    .results-info {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
        padding: 0.75rem;
    }
    
    /* Empty state */
    .empty-state {
        padding: 1.5rem 1rem;
    }
    
    .empty-state i {
        font-size: 2rem;
    }
    
    .empty-state h5 {
        font-size: 1rem;
    }
    
    /* Tab content wrapper */
    .tab-content-wrapper {
        margin-top: 1rem;
    }
}

.order-footer {
    display: flex;
    justify-content: space-between; /* Changed from default */
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Extra small devices (phones, less than 400px) */
@media (max-width: 400px) {
    .container-fluid {
        padding: 0 0.5rem;
    }
    
    .main-content {
        padding: 0.5rem 0 3.5rem 0;
    }
    
    /* Stats cards */
    .header-stats {
        gap: 0.375rem;
    }
    
    .stat-card {
        padding: 0.625rem;
        min-height: 65px;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    /* Tabs for very small screens */
    .tab-btn {
        flex: 1 0 calc(33.333% - 0.25rem);
        min-height: 60px;
        padding: 0.375rem 0.125rem;
    }
    
    .tab-btn:nth-child(4),
    .tab-btn:nth-child(5) {
        flex: 1 0 calc(50% - 0.25rem);
    }
    
    .tab-btn .fas {
        font-size: 0.8rem;
    }
    
    .tab-btn .tab-text {
        font-size: 0.6rem;
        max-height: 1.8em;
    }
    
    /* Filter panel even more compact */
    .filter-panel {
        padding: 0.625rem;
        max-height: 48px;
    }
    
    .filter-header h6 {
        font-size: 0.85rem;
    }
    
    .filter-header .filter-toggle {
        width: 28px;
        height: 28px;
    }
    
    .filter-group .form-control,
    .filter-group .form-select {
        height: 38px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .filter-group .form-control::placeholder,
    .filter-group .form-select::placeholder {
        font-size: 0.8rem;
    }
    
    /* Order card */
    .order-card {
        padding: 0.75rem;
    }
    
    /* Footer buttons stack */
    .order-footer {
        flex-direction: column;
        gap: 0.375rem;
    }
    
    .order-footer button {
        width: 100%;
    }


    
    /* Smaller image preview */
    .image-preview-item {
        width: 50px;
        height: 50px;
    }
    
    /* FAB smaller */
    .fab {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
}

/* Small devices (landscape phones, 577px to 767px) */
@media (min-width: 577px) and (max-width: 767px) {
    .header-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 0.875rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    /* Tabs for landscape - all in one row */
    .tab-navigation {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.25rem;
    }
    
    .tab-btn {
        flex: 0 0 auto;
        padding: 0.625rem 0.5rem;
        min-height: 60px;
        flex-direction: column;
        width: 120px;
    }
    
    .tab-btn .fas {
        font-size: 0.9rem;
        margin-bottom: 0.125rem;
    }
    
    .tab-btn .tab-text {
        font-size: 0.7rem;
        display: block;
    }
    
    /* Filter panel for landscape */
    .filter-panel {
        max-height: 55px;
    }
    
    .filter-panel.expanded {
        max-height: 500px;
    }
    
    .filter-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    /* Cards grid */
    .orders-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Tablet optimizations (768px to 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Tabs */
    .tab-navigation {
        display: flex;
        flex-wrap: wrap;
        gap: 0.375rem;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 140px;
        padding: 0.875rem 0.5rem;
        min-height: 70px;
        flex-direction: column;
    }
    
    .tab-btn .fas {
        font-size: 1rem;
    }
    
    .tab-btn .tab-text {
        font-size: 0.8rem;
        display: block;
    }
    
    /* Filter panel starts expanded on tablets */
    .filter-panel {
        max-height: 1000px;
    }
    
    .filter-panel.collapsed {
        max-height: 60px;
    }
    
    /* Cards grid */
    .orders-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    .header-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Filter panel adjustments */
    .filter-panel {
        padding: 1rem;
    }
    
    .filter-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop optimizations (1025px and above) */
@media (min-width: 1025px) {
    /* Tabs */
    .tab-navigation {
        display: flex;
        gap: 0.5rem;
    }
    
    .tab-btn {
        flex: 1;
        padding: 1rem 0.5rem;
        min-height: 70px;
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .tab-btn .fas {
        font-size: 1.1rem;
    }
    
    .tab-btn .tab-text {
        font-size: 0.9rem;
        display: inline;
    }
    
    /* Filter panel starts expanded on desktop */
    .filter-panel {
        max-height: 1000px;
    }
    
    .filter-panel.collapsed {
        max-height: 60px;
    }
    
    /* Cards grid */
    .orders-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Stats - 4 per row on desktop */
    .header-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large desktop screens (1440px and above) */
@media (min-width: 1440px) {
    .container-fluid {
        max-width: 1600px;
    }
    
    .orders-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .tab-btn {
        padding: 1.25rem 1rem;
    }
    
    .tab-btn .tab-text {
        font-size: 1rem;
    }
    
    .filter-panel {
        padding: 1.5rem;
    }
}