/* Luxury Color Palette */
:root {
    --primary: #1a1a2e;
    --secondary: #16213e;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #d63031;
    --light: #f8f9fa;
    --dark: #0f0f23;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --sidebar-width: 260px;
}

/* Base Styles */
* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #2d3748;
    font-size: 0.9375rem;
    min-height: 100%;
}

html {
    position: relative;
    min-height: 100%;
    font-size: 16px;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.sidebar-brand:hover {
    color: #fff;
}

.sidebar-nav {
    position: absolute;
    top: 65px;
    bottom: 65px;
    left: 0;
    right: 0;
    padding: 1rem 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
    scrollbar-width: thin;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.4);
}

.sidebar-nav .nav-link {
    color: rgba(255,255,255,0.7);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    margin-right: 0.75rem;
    width: 24px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-left-color: var(--accent);
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 1rem 0;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.8);
}

.user-info i {
    font-size: 2rem;
    margin-right: 0.75rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}

/* Page Content */
#page-content-wrapper {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
}

#wrapper.toggled .sidebar {
    transform: translateX(-100%);
}

#wrapper.toggled #page-content-wrapper {
    width: 100%;
    margin-left: 0;
}

/* Topbar */
.topbar {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 0.75rem 1rem;
}

.topbar .btn-link {
    color: var(--primary);
    font-size: 1.5rem;
}

/* Content Area */
.content-area {
    padding: 2rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* Stat Cards */
.stat-card {
    padding: 1.5rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-icon.primary { background: rgba(233, 69, 96, 0.1); color: var(--accent); }
.stat-card .stat-icon.success { background: rgba(0, 184, 148, 0.1); color: var(--success); }
.stat-card .stat-icon.warning { background: rgba(253, 203, 110, 0.1); color: #e17055; }
.stat-card .stat-icon.danger { background: rgba(214, 48, 49, 0.1); color: var(--danger); }
.stat-card .stat-icon.info { background: rgba(0, 123, 255, 0.1); color: #007bff; }

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-color: var(--border-color);
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Buttons */
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    border-radius: 8px;
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-outline-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn {
    border-radius: 8px;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--border-color);
    padding: 0.625rem 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.form-label {
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

.badge.bg-success { background: var(--success) !important; }
.badge.bg-warning { background: var(--warning) !important; color: #000; }
.badge.bg-danger { background: var(--danger) !important; }

/* Alerts */
.alert {
    border: none;
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.alert-success {
    background: rgba(0, 184, 148, 0.1);
    color: #00a383;
}

.alert-danger {
    background: rgba(214, 48, 49, 0.1);
    color: #c0392b;
}

.alert-warning {
    background: rgba(253, 203, 110, 0.1);
    color: #e17055;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 2rem;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-card .logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-card .logo i {
    font-size: 3rem;
    color: var(--accent);
}

.auth-card .logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.5rem;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* Low Stock & Alerts */
.low-stock { color: var(--warning); }
.out-of-stock { color: var(--danger); }
.in-stock { color: var(--success); }

/* Sync Status */
.sync-status {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #f8f9fa;
}

.sync-status.connected { border-left: 3px solid var(--success); }
.sync-status.disconnected { border-left: 3px solid var(--danger); }

/* Product Images */
.product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: #f8f9fa;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Dropdown */
.dropdown-menu {
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background: #f8f9fa;
}

/* Pagination */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border-radius: 8px;
    border: none;
    color: var(--primary);
    padding: 0.5rem 0.875rem;
}

.page-link:hover {
    background: #e9ecef;
}

.page-item.active .page-link {
    background: var(--accent);
    color: #fff;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    #wrapper.toggled .sidebar {
        transform: translateX(0);
    }

    #page-content-wrapper {
        width: 100%;
        margin-left: 0;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card, .stat-card {
    animation: fadeIn 0.3s ease;
}

/* Stock Status Colors */
.stock-ok { color: var(--success); }
.stock-low { color: var(--warning); }
.stock-out { color: var(--danger); }

/* Quick Actions */
.quick-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Modal */
.modal-content {
    border: none;
    border-radius: 16px;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

/* Focus States */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--accent);
}

/* Data rows */
.data-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.data-row:last-child {
    border-bottom: none;
}

/* Search box */
.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    padding-left: 2.75rem;
}

/* Action buttons row */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Status indicators */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--danger); }
.status-dot.pending { background: var(--warning); }

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    min-width: 300px;
    max-width: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: toastSlideIn 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-info {
    border-left-color: var(--accent);
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--accent); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

.toast.hiding {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Product image in table */
.product-thumb {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 8px;
    background: #f5f7fa;
}
