/* ===========================================
   RESPONSIVE & MOBILE STYLES FOR ADMIN PORTAL
   =========================================== */

/* Tablet & Medium Screens */
@media (max-width: 1200px) {
    .admin-sidebar {
        width: 240px;
    }
    
    #orderMenuGrid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    #menuItemsGrid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* Tablet Portrait & Small Laptops */
@media (max-width: 992px) {
    .admin-header {
        padding: 1.25rem 1.5rem;
    }
    
    .admin-main {
        padding: 1.5rem;
    }
    
    /* Stack order creation grid on tablets */
    #fnbOrdersView > div {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    #fnbOrdersView .card[style*="position: sticky"] {
        position: relative !important;
        top: 0 !important;
    }
}

/* Mobile Landscape & Small Tablets */
@media (max-width: 768px) {
    .admin-header h1 {
        font-size: 20px;
    }
    
    .admin-main {
        padding: 1.25rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .section-header h2 {
        font-size: 24px;
    }
    
    .section-header > div:last-child {
        width: 100%;
    }
    
    .section-header > div:last-child > div {
        width: 100%;
        flex-direction: column;
    }
    
    .section-header button,
    .section-header .btn {
        width: 100%;
    }
    
    #menuItemsGrid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    #orderMenuGrid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .admin-table {
        font-size: 13px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.75rem 0.85rem;
    }
    
    /* Stack form fields on mobile */
    form > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile Portrait */
@media (max-width: 576px) {
    .admin-header {
        padding: 1rem 1.25rem;
        flex-wrap: wrap;
    }
    
    .admin-header h1 {
        font-size: 18px;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .admin-header .btn {
        width: 100%;
    }
    
    .admin-main {
        padding: 1rem;
    }
    
    .section-header h2 {
        font-size: 22px;
    }
    
    #menuItemsGrid {
        grid-template-columns: 1fr;
    }
    
    #orderMenuGrid {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        padding: 1rem 1.25rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-table {
        min-width: 600px;
    }
    
    .menu-item-actions {
        flex-direction: column;
    }
    
    .menu-item-actions button {
        width: 100%;
    }
}

/* Mobile Sidebar Overlay */
body.sidebar-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

body.sidebar-open.sidebar-visible::before {
    opacity: 1;
    pointer-events: auto;
}

/* Smooth Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-pane.active {
    animation: fadeIn 0.3s ease-out;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 2rem;
    color: #a0aec0;
    font-style: italic;
}

.loading::before {
    content: '⏳ ';
    margin-right: 0.5rem;
}

/* Error States */
.error-message {
    background: #fed7d7;
    border: 1.5px solid #fc8181;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    color: #742a2a;
    margin: 1rem 0;
}

.error-message::before {
    content: '⚠️ ';
    margin-right: 0.5rem;
}

/* Success States */
.success-message {
    background: #c6f6d5;
    border: 1.5px solid #68d391;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    color: #22543d;
    margin: 1rem 0;
}

.success-message::before {
    content: '✅ ';
    margin-right: 0.5rem;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #a0aec0;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.empty-state-description {
    font-size: 14px;
    color: #718096;
}

/* Print Styles */
@media print {
    .admin-sidebar,
    .admin-header,
    .btn,
    button,
    .no-print {
        display: none !important;
    }
    
    .admin-main {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .admin-table {
        page-break-inside: auto;
    }
    
    .admin-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.p-0 { padding: 0; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Accessibility Improvements */
.btn:focus,
input:focus,
select:focus,
textarea:focus,
.sidebar-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.btn:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed in future */
}
