@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Vibrant Color Palette */
    --primary: #6366f1;
    /* Indigo */
    --primary-color: #6366f1;
    /* Fallback for older code */
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    /* Pink */
    --accent: #f59e0b;
    /* Amber/Gold */
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --info: #0ea5e9;

    /* Brand Colors (Used inline in admin panels) */
    --brand-blue: #3b82f6;
    --brand-light-blue: #60a5fa;
    --brand-green: #10b981;
    --brand-purple: #8b5cf6;
    --brand-orange: #f97316;
    --brand-pink: #ec4899;

    /* Backgrounds & Surfaces */
    --bg-body: #f1f5f9;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;

    /* Sidebar Specific (Dark Theme) */
    --sidebar-bg-gradient: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    --sidebar-text: #e0e7ff;
    --sidebar-text-muted: #818cf8;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.1);

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', sans-serif;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    /* Soft animated background mesh */
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ---------------------------------------------------
    SIDEBAR (Dark & Premium)
----------------------------------------------------- */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--sidebar-bg-gradient);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 25px 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transition: var(--transition-smooth);
    overflow-x: hidden;
    white-space: nowrap;
}

.sidebar.collapsed {
    width: 0;
    padding: 0;
    border: none;
}

.sidebar-header {
    padding: 0 25px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 25px;
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header i {
    color: var(--accent);
    font-size: 1.8rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0 15px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 5px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.menu-section {
    font-size: 0.85rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
    margin-top: 15px !important;
    margin-bottom: 8px !important;
    padding: 12px 20px !important;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 10px;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    background: transparent;
}

.menu-section:hover {
    background: var(--sidebar-hover-bg) !important;
    color: #ffffff !important;
}

.menu-section:active {
    transform: scale(0.98);
}

.menu-section:not(.collapsed) {
    color: #ffffff !important;
}

.menu-item-wrapper {
    margin-bottom: 6px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 20px !important;
    color: var(--sidebar-text) !important;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500 !important;
    font-size: 1rem !important;
    transition: var(--transition-smooth);
    border-left: 4px solid transparent;
}

.menu-item i {
    margin-right: 15px;
    font-size: 1.3rem !important;
    width: 24px;
    text-align: center;
    color: var(--sidebar-text-muted) !important;
    transition: var(--transition-fast);
}

/* Hover & Active States */
.menu-item:hover {
    background: var(--sidebar-hover-bg) !important;
    color: #ffffff !important;
    transform: translateX(5px);
    border-left: 4px solid var(--accent);
}

.menu-item:hover i {
    color: var(--accent) !important;
    transform: scale(1.1);
}

.menu-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.4), rgba(99, 102, 241, 0.1)) !important;
    color: #ffffff !important;
    border-left: 4px solid var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.menu-item.active i {
    color: var(--accent) !important;
}

/* ---------------------------------------------------
    MAIN CONTENT & HEADER
----------------------------------------------------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-header {
    height: 75px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 35px;
    z-index: 50;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
}

.icon-btn {
    background: #f1f5f9;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    position: relative;
    cursor: pointer;
    margin-right: 20px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: #e2e8f0;
    color: var(--primary, #6366f1);
    transform: translateY(-2px);
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 3px 6px;
    border-radius: 12px;
    font-weight: 700;
    border: 2px solid white;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px 6px 6px;
    border-radius: 30px;
    transition: var(--transition-fast);
}

.user-profile:hover {
    background: rgba(0, 0, 0, 0.03);
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* ---------------------------------------------------
    PAGE CONTENT & COMPONENTS
----------------------------------------------------- */
.content-area {
    padding: 25px;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.page-header {
    margin-bottom: 35px;
}

.page-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.breadcrumb {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

.breadcrumb span {
    margin: 0 5px;
}

.breadcrumb span:last-child {
    color: var(--primary, #6366f1);
    font-weight: 600;
}

/* Cards (Glassmorphism + Lift Effect) */
.card,
.glass-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.card:hover,
.glass-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

/* Buttons */
.btn,
.btn-primary {
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Outfit', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover, #4f46e5));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary, #6366f1);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 1rem top 50%;
    background-size: 0.65rem auto;
    padding-right: 2.5rem;
}

/* Utilities */
.truncate-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 15px;
}

.data-table th,
.data-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.data-table th {
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.01);
}

.data-table tr {
    transition: var(--transition-fast);
}

.data-table tr:hover td {
    background: rgba(99, 102, 241, 0.02);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Dashboard Stat Cards */
.stat-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-details h3 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
}

.stat-details p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Status Badges */
.badge-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
    position: static !important;
    display: inline-block;
    border: none;
}

.badge-pending {
    background: #fef9c3;
    color: #854d0e;
    position: static !important;
    display: inline-block;
    border: none;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
    position: static !important;
    display: inline-block;
    border: none;
}

/* Order and Delivery Statuses */
.badge-ready { background: #e0e7ff; color: #4338ca; position: static !important; display: inline-block; border: none; }
.badge-shipped, .badge-out_for_delivery { background: #fef08a; color: #854d0e; position: static !important; display: inline-block; border: none; }
.badge-delivered, .badge-completed { background: #dcfce7; color: #166534; position: static !important; display: inline-block; border: none; }
.badge-cancelled, .badge-failed { background: #fee2e2; color: #991b1b; position: static !important; display: inline-block; border: none; }
.badge-assigned { background: #cffafe; color: #0891b2; position: static !important; display: inline-block; border: none; }
.badge-picked_up { background: #e0f2fe; color: #0284c7; position: static !important; display: inline-block; border: none; }
.badge-confirmed, .badge-processing { background: #fef3c7; color: #92400e; position: static !important; display: inline-block; border: none; }
.badge-out_of_stock { background: #fee2e2; color: #991b1b; position: static !important; display: inline-block; border: none; }
.badge-banned { background: #111827; color: #f87171; position: static !important; display: inline-block; border: none; }


/* ---------------------------------------------------
    RESPONSIVE DESIGN (Media Queries)
----------------------------------------------------- */
@media screen and (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        flex: 1;
    }

    .content-area {
        padding: 25px;
    }

    .stat-card {
        gap: 15px;
        padding: 20px;
    }
}

@media screen and (max-width: 768px) {
    body {
        height: auto;
        overflow: auto;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .menu-toggle {
        display: block !important;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-main);
        cursor: pointer;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px !important;
        height: 100vh;
        z-index: 9999;
        padding: 25px 0;
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
        transition: left 0.3s ease, width 0.3s ease;
    }

    .sidebar.collapsed {
        left: 0; /* Toggling 'collapsed' on mobile actually shows it */
        width: 280px !important;
    }

    .sidebar-header {
        margin-bottom: 15px;
        padding: 0 20px 15px;
        justify-content: flex-start;
    }

    .sidebar-menu {
        display: block;
        padding: 0 15px 10px;
        overflow-y: auto;
        white-space: normal;
    }

    .menu-section {
        display: flex;
    }

    .menu-item {
        white-space: normal;
        padding: 12px 15px !important;
        font-size: 0.95rem !important;
    }

    .main-content {
        height: auto;
        overflow: visible;
        width: 100%;
    }

    .top-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
        height: auto;
    }

    .header-left,
    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .content-area {
        padding: 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .card,
    .glass-card {
        padding: 20px;
        overflow-x: auto;
        /* Ensure tables can scroll */
    }

    .data-table th,
    .data-table td {
        padding: 12px 15px;
    }
}

@media screen and (max-width: 480px) {
    .page-header h1 {
        font-size: 1.8rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .stat-icon {
        margin: 0 auto;
    }
}

/* Action Dropdowns */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 5px;
    transition: color 0.2s;
}

.dropdown-btn:hover {
    color: var(--primary, #6366f1);
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--surface);
    min-width: 150px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    z-index: 100;
    overflow: hidden;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 10px 15px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
    border: none;
    width: 100%;
    text-align: left;
    background: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.dropdown-item i {
    width: 16px;
    margin-right: 8px;
    color: var(--text-muted);
    text-align: center;
}

.dropdown-item:hover {
    background: rgba(0, 0, 0, 0.02);
    color: var(--primary, #6366f1);
}

.dropdown-item:hover i {
    color: var(--primary, #6366f1);
}

.dropdown-item.text-danger:hover {
    background: #fee2e2;
    color: #dc2626;
}

.dropdown-item.text-danger:hover i {
    color: #dc2626;
}

/* ========================================
   Panel Language Bar (Admin / Shopkeeper / Super-Admin / Delivery)
   ======================================== */
.panel-lang-bar {
    background: linear-gradient(90deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    padding: 5px 24px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 60;
    flex-shrink: 0;
}

.panel-lang-bar .lang-pills {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 20px;
    padding: 2px 4px;
    gap: 4px;
}

.panel-lang-bar .lang-btn {
    border: none;
    outline: none;
    cursor: pointer;
    background: transparent;
    color: #f8fafc;
    padding: 3px 12px;
    border-radius: 14px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.panel-lang-bar .lang-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.panel-lang-bar .lang-btn.active {
    background: #ffffff;
    color: #1e1b4b;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Suppress Google Translate UI chrome in panels */
.goog-te-banner-frame,
iframe.goog-te-banner-frame { display: none !important; }
body { top: 0 !important; }
#panel-google-translate-el { display: none !important; }
.goog-tooltip, .goog-tooltip:hover { display: none !important; }
.goog-text-highlight { background: transparent !important; border: none !important; box-shadow: none !important; }