/* =========================================
   Warehouse Intelligence Dashboard
   Static Version - Hostinger Compatible
   ========================================= */

:root {
    --bg-dark: #121212;
    --bg-card: #1E1E1E;
    --bg-sidebar: #161920;
    --border-color: #333;
    --accent-green: #4CAF50;
    --accent-red: #EF553B;
    --accent-blue: #636EFA;
    --accent-purple: #AB63FA;
    --text-primary: #FFFFFF;
    --text-secondary: #9E9E9E;
    --text-muted: #666;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin: 0;
}

.sidebar-section {
    background: #1F232E;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #2F3445;
}

.sidebar-label {
    color: #8B92A6;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 600;
    display: block;
}

.status-badge {
    padding: 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    background: rgba(76, 175, 80, 0.1);
    border-left: 3px solid var(--accent-green);
    color: var(--accent-green);
}

.status-badge.error {
    background: rgba(239, 85, 59, 0.1);
    border-left-color: var(--accent-red);
    color: var(--accent-red);
}

.data-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.data-info span {
    color: var(--accent-green);
}

.sidebar-footer {
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 20px 30px;
    overflow-y: auto;
}

/* Header */
.page-header {
    background: var(--bg-card);
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 1.4rem;
    margin: 0;
    color: var(--text-primary);
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #B0B0B0;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-button:hover {
    border-color: #555;
    color: var(--text-primary);
    transform: translateY(-2px);
}

.tab-button.active {
    background: var(--accent-green);
    color: var(--text-primary);
    border-color: var(--accent-green);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* Tab Panels */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Cards */
.erp-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    text-align: center;
}

.erp-card h4 {
    margin: 0 0 18px 0;
    font-size: 1rem;
    color: var(--text-primary);
    text-align: center;
}

.erp-card p {
    text-align: center;
}

/* Center chart containers within cards */
.chart-container {
    text-align: center;
}

/* Chart Layouts */
.chart-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.chart-row .erp-card:only-child {
    grid-column: 1 / -1;
}

.chart-wide {
    grid-column: span 1;
}

.chart-container {
    min-height: 350px;
}

.table-container {
    max-height: 350px;
    overflow-y: auto;
}

/* Metrics */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-green);
    border-radius: 4px;
    padding: 15px 20px;
    text-align: center;
    /* Centering added */
}

.metric-card.negative {
    border-left-color: var(--accent-red);
}

.metric-card.neutral {
    border-left-color: var(--accent-purple);
}

/* ... existing variants ... */

.metric-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 5px;
    text-align: center;
    /* Centering added */
}

.metric-value {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: bold;
    line-height: 1.2;
    text-align: center;
    /* Centering added */
}

.metric-delta {
    font-size: 0.85rem;
    margin-top: 5px;
    color: var(--text-secondary);
    text-align: center;
    /* Centering added */
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    position: sticky;
    top: 0;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Responsive */
@media (max-width: 1200px) {
    .chart-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

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

    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================
   RTL Support (Arabic) 
   ========================================= */
[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
    border-right: none;
    border-left: 1px solid var(--border-color);
}

[dir="rtl"] .main-content {
    margin-left: 0 !important;
    margin-right: 260px !important;
    width: calc(100% - 260px);
}

/* Responsive adjustments for RTL */
@media (max-width: 768px) {
    [dir="rtl"] .main-content {
        margin-right: 0;
    }
}