/**
 * AJCart / Stock Manager — global theme tokens
 *
 * Change colors HERE to update the whole app.
 *
 * CSS usage:  color: var(--theme-primary);
 * JS usage:   AppTheme.primary()  or  AppTheme.color('chart-1')
 */
:root {
    /* Brand */
    --theme-primary: #0d7a5c;
    --theme-primary-dark: #095c46;
    --theme-primary-light: #14b8a6;
    --theme-primary-soft: #e8f5f0;
    --theme-primary-rgb: 13, 122, 92;
    --theme-accent: #435ebe;
    --theme-accent-light: #57caeb;


    /* --theme-primary: #2563eb;
    --theme-primary-dark: #1d4ed8;
    --theme-primary-light: #60a5fa;
    --theme-primary-soft: #eff6ff;
    --theme-primary-rgb: 37, 99, 235;
    --theme-accent: #435ebe;
    --theme-accent-light: #57caeb; */
    

    /* Text */
    --theme-text: #25396f;
    --theme-text-secondary: #334155;
    --theme-text-muted: #64748b;
    --theme-text-light: #7c8db5;
    --theme-text-inverse: #ffffff;

    /* Surfaces */
    --theme-bg: #f2f7ff;
    --theme-surface: #ffffff;
    --theme-surface-alt: #f8fafc;
    --theme-surface-hover: #f1f5f9;
    --theme-border: #e8edf5;
    --theme-border-light: #f1f5f9;
    --theme-border-strong: #e2e8f0;

    /* Status */
    --theme-danger: #dc3545;
    --theme-danger-dark: #b91c1c;
    --theme-danger-soft: #fef2f2;
    --theme-danger-border: #fecaca;
    --theme-danger-border-hover: #fca5a5;
    --theme-success: #198754;
    --theme-warning: #ffc107;
    --theme-info: #0dcaf0;

    /* Gradients */
    --theme-gradient-primary: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-primary-light) 100%);
    --theme-gradient-avatar: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-light));

    /* Shadows */
    --theme-shadow-sm: 0 1px 3px rgba(37, 57, 111, 0.04);
    --theme-shadow-md: 0 5px 20px rgba(37, 57, 111, 0.06);
    --theme-shadow-lg: 0 12px 40px rgba(37, 57, 111, 0.12);
    --theme-shadow-sidebar: 4px 0 24px rgba(15, 23, 42, 0.15);
    --theme-shadow-primary: 0 4px 12px rgba(var(--theme-primary-rgb), 0.3);
    --theme-shadow-accent: 0 4px 14px rgba(var(--theme-primary-rgb), 0.25);

    /* Layout */
    --theme-sidebar-width: 300px;
    --theme-radius-sm: 0.45rem;
    --theme-radius-md: 0.65rem;
    --theme-radius-lg: 0.7rem;
    --theme-radius-xl: 0.85rem;

    /* Charts (used by JS via AppTheme) */
    --theme-chart-1: #0d7a5c;
    --theme-chart-2: #435ebe;
    --theme-chart-3: #57caeb;
    --theme-chart-4: #5ddab4;
    --theme-chart-5: #ff7976;
    --theme-chart-label: #304568;
    --theme-chart-grid: #e2e8f0;

    /* Legacy aliases — keep old names working */
    --shell-primary: var(--theme-primary);
    --shell-primary-dark: var(--theme-primary-dark);
    --shell-sidebar-width: var(--theme-sidebar-width);

    /* Landing page aliases */
    --stock-primary: #10336b;
    --stock-primary-light: #1a4a8a;
    --stock-accent: var(--theme-primary);
    --stock-accent-hover: var(--theme-primary-dark);
    --stock-accent-soft: var(--theme-primary-soft);
    --stock-red: #a61917;
    --stock-bg: #f4f7fb;
    --stock-surface: var(--theme-surface);
    --stock-border: var(--theme-border-strong);
    --stock-text: #0f172a;
    --stock-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
    --stock-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
}

/* Bootstrap overrides for console pages */
body.stock-app {
    --bs-primary: var(--theme-primary);
    --bs-primary-rgb: var(--theme-primary-rgb);
    --bs-success: var(--theme-primary);
    --bs-success-rgb: var(--theme-primary-rgb);
}

body.stock-app .btn-primary,
body.stock-app .btn-success {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: var(--theme-text-inverse) !important;
}

body.stock-app .btn-primary:hover,
body.stock-app .btn-primary:focus,
body.stock-app .btn-primary:active,
body.stock-app .btn-success:hover,
body.stock-app .btn-success:focus,
body.stock-app .btn-success:active {
    background-color: var(--theme-primary-dark) !important;
    border-color: var(--theme-primary-dark) !important;
    color: var(--theme-text-inverse) !important;
}

body.stock-app #quickAddBtn {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: var(--theme-text-inverse) !important;
    box-shadow: var(--theme-shadow-primary) !important;
}

body.stock-app #quickAddBtn:hover,
body.stock-app #quickAddBtn:focus {
    background-color: var(--theme-primary-dark) !important;
    border-color: var(--theme-primary-dark) !important;
}

body.stock-app #scanBtn {
    background-color: var(--theme-primary-dark) !important;
    border-color: var(--theme-primary-dark) !important;
    color: var(--theme-text-inverse) !important;
    box-shadow: var(--theme-shadow-primary) !important;
}

body.stock-app #scanBtn:hover,
body.stock-app #scanBtn:focus {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
}

/* Global console modals — shared by Items, Categories, Devices, Groups, RFID, etc. */
body.stock-app .modal-content {
    border: none;
    border-radius: var(--theme-radius-xl);
    box-shadow: var(--theme-shadow-lg);
    background: var(--theme-surface);
}

body.stock-app .modal-header,
body.stock-app .modal-header.gradient-custom {
    background: var(--theme-gradient-primary);
    border: none;
    padding: 1rem 1.25rem;
    border-radius: var(--theme-radius-xl) var(--theme-radius-xl) 0 0;
}

body.stock-app .modal-header .modal-title {
    color: var(--theme-text-inverse);
    font-size: 1.05rem;
    font-weight: 600;
}

body.stock-app .modal-icon-circle {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.stock-app .modal-footer {
    background: var(--theme-surface-alt);
    border-top: 1px solid var(--theme-border);
    border-radius: 0 0 var(--theme-radius-xl) var(--theme-radius-xl);
}

body.stock-app .modal .form-control:focus,
body.stock-app .modal .form-select:focus {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), 0.12);
}

body.stock-app .btn-light-secondary {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border-strong);
    color: var(--theme-text-secondary);
}

body.stock-app .btn-light-secondary:hover {
    background: var(--theme-surface-hover);
    border-color: var(--theme-border-strong);
    color: var(--theme-text);
}

body.stock-app .table-primary {
    --bs-table-bg: var(--theme-primary-soft);
    --bs-table-color: var(--theme-text);
    --bs-table-border-color: var(--theme-border);
    color: var(--theme-text);
}

/* SweetAlert2 — match global theme */
body.stock-app .swal2-popup {
    border-radius: var(--theme-radius-xl);
    font-family: inherit;
}

body.stock-app .swal2-confirm {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
}

body.stock-app .swal2-confirm:hover {
    background-color: var(--theme-primary-dark) !important;
    border-color: var(--theme-primary-dark) !important;
}

body.stock-app .swal2-styled.swal2-confirm:focus {
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), 0.25) !important;
}

body.stock-app .swal2-input:focus,
body.stock-app .swal2-textarea:focus {
    border-color: var(--theme-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), 0.12) !important;
}
