/* Admin Dashboard Styles */
:root {
    --primary-color: #2c5aa0;
    --secondary-color: #34495e;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #3498db;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --sidebar-width: 280px;
    --header-height: 70px;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
    
    /* Mobile Touch Targets */
    --touch-input-height: 52px;
    --touch-btn-height: 56px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-logo {
    margin-bottom: 2rem;
}

.loading-logo i {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

.loading-logo h3 {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Header */
.navbar {
    height: var(--header-height);
    box-shadow: var(--box-shadow);
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 600;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.7rem;
}

.notification-dropdown {
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown .dropdown-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
}

.notification-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: white;
    box-shadow: var(--box-shadow);
    z-index: 999;
    transform: translateX(0);
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.sidebar-header h5 {
    margin: 0;
    font-weight: 600;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: #666;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-nav .nav-link:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
    background-color: var(--primary-color);
    color: white;
    border-right: 4px solid var(--secondary-color);
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.sidebar-nav .nav-link span {
    flex: 1;
}

.sidebar-nav .badge {
    font-size: 0.7rem;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 2rem;
    min-height: calc(100vh - var(--header-height));
    transition: var(--transition);
}

.main-content.expanded {
    margin-left: 0;
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.page-header h2 {
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.page-header p {
    margin: 0;
    font-size: 1.1rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Metric Cards */
.metric-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
}

.metric-card.revenue::before { background: var(--success-color); }
.metric-card.orders::before { background: var(--info-color); }
.metric-card.customers::before { background: var(--warning-color); }
.metric-card.inventory::before { background: var(--danger-color); }

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
    font-size: 1.5rem;
    color: white;
}

.metric-card.revenue .metric-icon { background: var(--success-color); }
.metric-card.orders .metric-icon { background: var(--info-color); }
.metric-card.customers .metric-icon { background: var(--warning-color); }
.metric-card.inventory .metric-icon { background: var(--danger-color); }

.metric-info h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.metric-info p {
    margin: 0;
    color: #666;
    font-size: 1.1rem;
}

.metric-change {
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.metric-change.positive { color: var(--success-color); }
.metric-change.negative { color: var(--danger-color); }

/* Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: white;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    color: var(--dark-color);
    transition: var(--transition);
    text-decoration: none;
    cursor: pointer;
}

.quick-action-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.quick-action-btn i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.quick-action-btn span {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
}

/* Recent Activity */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: var(--border-radius);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.activity-content h6 {
    margin: 0 0 0.25rem 0;
}

.activity-content p {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    color: #666;
}

.activity-content small {
    color: #999;
}

/* Action Buttons Global */
.action-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 0.25rem;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.action-btn.btn-view { color: var(--info-color); border-color: var(--info-color); }
.action-btn.btn-view:hover { background: var(--info-color); color: white; }

.action-btn.btn-edit { color: var(--warning-color); border-color: var(--warning-color); }
.action-btn.btn-edit:hover { background: var(--warning-color); color: white; }

.action-btn.btn-delete { color: var(--danger-color); border-color: var(--danger-color); }
.action-btn.btn-delete:hover { background: var(--danger-color); color: white; }

/* --- Mobile / Native App Styling --- */
@media (max-width: 768px) {
    /* Layout Reset */
    body {
        font-size: 16px; /* Base font size boost */
    }

    /* Navbar Mobile */
    .navbar {
        padding: 0.5rem 1rem;
        height: 60px;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }

    /* Sidebar as Mobile Drawer */
    .sidebar {
        transform: translateX(-100%);
        width: 85%;
        max-width: 320px;
        height: 100vh;
        top: 0;
        z-index: 2000;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }

    /* Backdrop for sidebar */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.show {
        display: block;
        opacity: 1;
    }

    /* Main Content Mobile */
    .main-content {
        margin-left: 0 !important; /* Force override */
        margin-top: 60px;
        padding: 1rem;
        width: 100%;
        min-height: calc(100vh - 60px);
    }

    /* Page Header Mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
        border-bottom: 1px solid #e0e0e0;
    }

    .page-header h2 {
        font-size: 1.75rem; /* Larger heading */
        margin-bottom: 0.25rem;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Native-like Buttons */
    .btn {
        height: var(--touch-btn-height);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 12px;
        width: 100%; /* Full width on mobile */
    }
    
    .header-actions .btn {
        width: 100%;
    }

    /* Native-like Inputs */
    .form-control, .form-select, .input-group-text {
        height: var(--touch-input-height);
        font-size: 1rem;
        border-radius: 8px;
    }
    
    label.form-label {
        font-size: 1rem;
        font-weight: 500;
        margin-bottom: 0.5rem;
        color: #444;
    }

    /* Cards Mobile */
    .card {
        border: none;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        border-radius: 12px;
        margin-bottom: 1rem;
    }

    .metric-card {
        margin-bottom: 1rem;
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .metric-info h3 {
        font-size: 2rem;
    }

    /* Tables Mobile */
    .table-responsive {
        border: 0;
        margin: 0 -1rem; /* Full bleed tables */
        width: calc(100% + 2rem);
    }
    
    .table {
        margin-bottom: 0;
    }
    
    .table th, .table td {
        white-space: nowrap;
        padding: 1rem;
        vertical-align: middle;
    }

    /* Quick Actions Grid Mobile */
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 cols on mobile */
        gap: 0.75rem;
    }
    
    .quick-action-btn {
        padding: 1rem;
        border-radius: 12px;
    }

    /* Modal Mobile */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 16px;
        border: none;
    }
    
    .modal-header {
        padding: 1.25rem 1.5rem;
        border-bottom: 1px solid #eee;
    }
    
    .modal-footer {
        flex-direction: column-reverse; /* Stack buttons, primary on top/bottom depending on preference, usually vertical stack */
        gap: 0.75rem;
    }
    
    .modal-footer > * {
        margin: 0;
        width: 100%;
    }

    /* Action Buttons in Tables */
    .action-btn {
        width: 44px; /* Larger touch target */
        height: 44px;
        font-size: 1.2rem;
    }

    /* Recent Activity & Lists */
    .activity-item {
        padding: 1rem;
        border-radius: 12px;
    }
}
