/* =============================================
   PanelX - Stylesheet principal
   ============================================= */

:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 60px;
    --sidebar-bg: #1e2a3a;
    --sidebar-hover: #2d3f54;
    --sidebar-active: #3b82f6;
    --sidebar-text: #c8d6e5;
    --sidebar-muted: #7f8ea3;
    --topbar-height: 56px;
    --body-bg: #f0f2f5;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-muted: #64748b;
}

* { box-sizing: border-box; }

body {
    background: var(--body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    margin: 0;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: width 0.25s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    min-height: var(--topbar-height);
}

.sidebar-logo {
    text-decoration: none;
    color: #fff;
    font-size: 20px;
    white-space: nowrap;
}

.sidebar-logo .logo-text { color: var(--sidebar-text); }
.sidebar-logo strong { color: #3b82f6; }

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: var(--sidebar-muted);
    padding: 4px 6px;
    cursor: pointer;
    transition: color 0.2s;
}
.sidebar-toggle-btn:hover { color: #fff; }

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-hover) transparent;
}

.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-track { background: transparent; }
.sidebar-body::-webkit-scrollbar-thumb { background: var(--sidebar-hover); border-radius: 2px; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 8px;
}

.sidebar-section { margin-top: 8px; }

.sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--sidebar-muted);
    padding: 6px 8px 2px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-section-title { opacity: 0; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
}

.sidebar-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-label {
    font-size: 13.5px;
    transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-label { opacity: 0; width: 0; overflow: hidden; }

/* Magazine in sidebar */
.sidebar-stores {
    padding: 8px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-store-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}

.sidebar-store-link:hover { background: var(--sidebar-hover); color: #fff; }

.store-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    text-align: center;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content.expanded { margin-left: var(--sidebar-collapsed-width); }

/* ===== TOPBAR ===== */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    height: var(--topbar-height);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-search { max-width: 360px; width: 100%; }

.avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--sidebar-active);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 24px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 18px;
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== ORDERS TABLE ===== */
.orders-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.orders-sidebar {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--topbar-height) + 24px);
}

.orders-main { flex: 1; min-width: 0; }

.filter-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 12px;
}

.filter-card-title {
    padding: 10px 14px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.filter-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.1s;
    border-bottom: 1px solid var(--border-color);
}

.filter-link:last-child { border-bottom: none; }
.filter-link:hover { background: #f8fafc; color: var(--sidebar-active); }
.filter-link.active { color: var(--sidebar-active); font-weight: 600; background: #eff6ff; }

.filter-link .filter-count {
    font-size: 11px;
    background: #e2e8f0;
    color: var(--text-muted);
    border-radius: 10px;
    padding: 1px 7px;
}

.filter-link.active .filter-count {
    background: #dbeafe;
    color: var(--sidebar-active);
}

/* Status dot pe filter */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    flex-shrink: 0;
}

/* ===== TABLE ===== */
.table-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-toolbar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.table thead th {
    background: #f8fafc;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 12px;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
    border-color: var(--border-color);
    font-size: 13px;
}

.table tbody tr:hover { background: #f8fafc; }

.order-number {
    font-weight: 600;
    color: var(--sidebar-active);
    font-size: 13px;
}

.order-number:hover { text-decoration: underline; }

.order-client { font-weight: 500; font-size: 13px; }
.order-source { font-size: 11px; color: var(--text-muted); }

.order-products { font-size: 12px; color: var(--text-muted); max-width: 250px; }
.order-products .product-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.order-total { font-weight: 600; font-size: 14px; }

/* Action buttons pe tabel */
.btn-action {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 5px;
}

/* ===== ORDER DETAIL ===== */
.order-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.order-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.order-info-row {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.order-info-row:last-child { border-bottom: none; }
.order-info-label { color: var(--text-muted); width: 130px; flex-shrink: 0; }
.order-info-value { font-weight: 500; }

.courier-btn {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
    font-weight: 500;
}

/* ===== LOGIN ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e2a3a 0%, #2d3f54 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}

.login-logo strong { color: var(--sidebar-active); }

/* ===== BADGES ===== */
.badge { font-size: 11px; font-weight: 500; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar .sidebar-label,
    .sidebar .sidebar-section-title,
    .sidebar .sidebar-stores {
        display: none;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }

    .orders-layout {
        flex-direction: column;
    }

    .orders-sidebar {
        width: 100%;
        position: static;
    }

    .page-content { padding: 12px; }

    .order-info-grid { grid-template-columns: 1fr; }
}

/* ===== ZEBRA SCANNER SPECIFIC ===== */
@media (max-width: 480px) {
    .table { font-size: 12px; }
    .table tbody td { padding: 8px 8px; }
    .btn { min-height: 38px; }
    input.form-control { min-height: 42px; font-size: 16px; }
}

/* ===== UTILITIES ===== */
.text-muted-sm { font-size: 12px; color: var(--text-muted); }
.border-start-primary { border-left: 3px solid var(--sidebar-active) !important; }
.fw-600 { font-weight: 600; }
.gap-2 { gap: 8px; }
