/**
 * LalinERP — Theme Override Stylesheet
 *
 * Red corporate color scheme overrides for the Aurora ERP base theme.
 * This file is loaded AFTER aurora.css and BEFORE aurora-override.css
 * in the CSS cascade to rebrand Indigo tokens with LalinERP Red.
 *
 * Cascade order:
 *   bootstrap.min.css → styles.css → aurora.css → lalin-theme.css
 *   → aurora-override.css → apple-design-system.css
 *
 * Sections:
 *   1. Design Token Overrides (:root)
 *   2. Dark Mode Token Overrides
 *   3. KPI Card Gradient Overrides
 *   4. Sidebar Active Item Accent
 *   5. Login Page — Two-Column Layout
 *   6. AI Components (Insights Panel, Smart Controls, Bottom Bar, Chips)
 *   7. Date Range Picker & Quick Actions
 *   8. Search Input Focus Ring
 */

/* ==========================================================================
   1. Design Token Overrides (:root)
   ========================================================================== */

:root {
    /* Primary palette — LalinERP Red */
    --aurora-primary: #E53935;
    --aurora-primary-hover: #C62828;
    --aurora-primary-light: #FFEBEE;
    --aurora-primary-dark: #B71C1C;

    /* Sidebar — Light theme */
    --aurora-sidebar-bg: #ffffff;
    --aurora-sidebar-hover: #FFF5F5;
    --aurora-sidebar-active: #E53935;
    --aurora-sidebar-text: #374151;
    --aurora-sidebar-text-active: #E53935;
}

/* ==========================================================================
   2. Dark Mode Token Overrides
   ========================================================================== */

[data-theme-mode="dark"] {
    --aurora-primary: #EF5350;
    --aurora-primary-hover: #E53935;
    --aurora-primary-light: rgba(229, 57, 53, 0.15);
    --aurora-primary-dark: #C62828;

    --aurora-sidebar-bg: #1a1a2e;
    --aurora-sidebar-hover: #2a2a3e;
    --aurora-sidebar-active: #EF5350;
    --aurora-sidebar-text: #a0aec0;
    --aurora-sidebar-text-active: #EF5350;
}

/* ==========================================================================
   3. KPI Card Gradient Overrides
   ========================================================================== */

/* Light mode — primary KPI gradient: red-based */
.aurora-kpi-primary {
    background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
    color: #C62828;
}

/* Dark mode — primary KPI gradient: red-based with transparency */
[data-theme-mode="dark"] .aurora-kpi-primary {
    background: linear-gradient(135deg, rgba(229, 57, 53, 0.15) 0%, rgba(229, 57, 53, 0.25) 100%);
    color: #EF9A9A;
}

/* Dark mode — other KPI gradients remain unchanged (inherited from aurora-override.css) */

/* ==========================================================================
   4. Sidebar Active Item Accent
   ========================================================================== */

/* Active menu item — red left-border accent */
.slide.active > .side-menu__item,
.slide.has-sub.open > .side-menu__item {
    color: var(--aurora-sidebar-text-active);
    border-inline-start: 3px solid var(--aurora-sidebar-active);
    background: var(--aurora-sidebar-hover);
}

/* Ensure active child items also get the red accent */
.slide.active > .side-menu__item .side-menu__label,
.slide.active > .side-menu__item .side-menu__icon {
    color: var(--aurora-sidebar-text-active);
}

/* ==========================================================================
   5. Login Page — Two-Column Layout
   ========================================================================== */


/* Container: full-viewport two-column layout */
.lalin-login-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Left panel: branding */
.lalin-login-brand {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #B71C1C 0%, #E53935 50%, #EF5350 100%);
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.lalin-login-logo {
    height: 56px;
    width: auto;
    margin-bottom: 1.5rem;
}

.lalin-login-brand h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.lalin-login-tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    text-align: center;
}

/* Module icons row */
.lalin-login-modules {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.lalin-login-module-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    opacity: 0.85;
}

.lalin-login-module-item i {
    font-size: 1.75rem;
    opacity: 0.9;
}

/* KPI preview graphics area */
.lalin-login-preview {
    width: 100%;
    max-width: 360px;
    opacity: 0.7;
    margin-top: 1rem;
}

.lalin-login-preview svg {
    width: 100%;
    height: auto;
}

/* Right panel: login form */
.lalin-login-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    background: #ffffff;
    max-width: 520px;
    min-width: 360px;
}

.lalin-login-form h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.5rem;
    text-align: center;
}

.lalin-login-form form {
    width: 100%;
    max-width: 380px;
}

.lalin-login-form .form-control:focus {
    border-color: #E53935;
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.15);
}

.lalin-login-form .btn-primary,
.lalin-login-form .btn-lalin-primary {
    background-color: #E53935;
    border-color: #E53935;
    color: #ffffff;
    font-weight: 600;
    width: 100%;
    padding: 0.625rem;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
}

.lalin-login-form .btn-primary:hover,
.lalin-login-form .btn-lalin-primary:hover {
    background-color: #C62828;
    border-color: #C62828;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.35);
}

.lalin-login-form .btn-outline-secondary {
    width: 100%;
    padding: 0.625rem;
    border-radius: 0.5rem;
}

/* Password toggle button */
.lalin-login-password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

[dir="rtl"] .lalin-login-password-toggle {
    right: auto;
    left: 0.75rem;
}

.lalin-login-password-toggle:hover {
    color: #64748b;
}

/* Links and secondary actions */
.lalin-login-forgot {
    font-size: 0.85rem;
    color: #E53935;
    text-decoration: none;
}

.lalin-login-forgot:hover {
    color: #C62828;
    text-decoration: underline;
}

.lalin-login-contact {
    font-size: 0.85rem;
    color: #64748b;
    text-decoration: none;
    text-align: center;
    display: block;
    margin-top: 1rem;
}

.lalin-login-contact:hover {
    color: #E53935;
}

/* Tab toggle between login and register */
.lalin-login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    width: 100%;
    max-width: 380px;
}

.lalin-login-tab {
    flex: 1;
    text-align: center;
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.lalin-login-tab.active {
    color: #E53935;
    border-bottom-color: #E53935;
}

.lalin-login-tab:hover:not(.active) {
    color: #64748b;
}

/* Responsive: stack columns below 768px */
@media (max-width: 767.98px) {
    .lalin-login-container {
        flex-direction: column;
    }

    .lalin-login-brand {
        padding: 2rem 1.5rem;
        min-height: auto;
    }

    .lalin-login-brand h1 {
        font-size: 1.75rem;
    }

    .lalin-login-preview {
        display: none;
    }

    .lalin-login-form {
        max-width: 100%;
        min-width: auto;
        padding: 2rem 1.5rem;
    }
}

/* RTL: mirror the two-column arrangement */
[dir="rtl"] .lalin-login-container {
    flex-direction: row-reverse;
}

[dir="rtl"] .lalin-login-password-toggle {
    right: auto;
    left: 0.75rem;
}

@media (max-width: 767.98px) {
    [dir="rtl"] .lalin-login-container {
        flex-direction: column;
    }
}

/* ==========================================================================
   6. AI Components
   ========================================================================== */

/* --------------------------------------------------------------------------
   6.1  AI Insights Panel (Dashboard sidebar)
   -------------------------------------------------------------------------- */

.lalin-ai-insights {
    border: 1px solid var(--aurora-border-color, #e2e8f0);
    border-radius: var(--aurora-card-radius, 0.75rem);
}

.lalin-ai-insights .card-header {
    background: transparent;
}

.lalin-ai-insights .card-title i {
    color: #E53935;
}

.lalin-insight-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--aurora-border-color, #e2e8f0);
    transition: background 0.15s ease;
}

.lalin-insight-item:last-child {
    border-bottom: none;
}

.lalin-insight-item:hover {
    background: var(--aurora-primary-light, #FFEBEE);
}

.lalin-insight-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.lalin-insight-content {
    flex: 1;
    min-width: 0;
}

.lalin-insight-content p {
    font-size: 0.85rem;
    color: var(--aurora-text-primary, #1e293b);
    line-height: 1.5;
}

.lalin-insight-content a {
    font-size: 0.8rem;
    color: #E53935;
    text-decoration: none;
    font-weight: 500;
}

.lalin-insight-content a:hover {
    color: #C62828;
    text-decoration: underline;
}

/* Dark mode */
[data-theme-mode="dark"] .lalin-insight-item:hover {
    background: rgba(229, 57, 53, 0.08);
}

[data-theme-mode="dark"] .lalin-insight-content a {
    color: #EF5350;
}

[data-theme-mode="dark"] .lalin-insight-content a:hover {
    color: #EF9A9A;
}

/* --------------------------------------------------------------------------
   6.2  Smart Controls Sidebar (Form validation panel)
   -------------------------------------------------------------------------- */

.lalin-smart-controls {
    border: 1px solid var(--aurora-border-color, #e2e8f0);
    border-radius: var(--aurora-card-radius, 0.75rem);
}

.lalin-smart-controls .card-header {
    background: transparent;
}

.lalin-smart-controls .card-title i {
    color: #E53935;
}

.lalin-validation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.625rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
    border-bottom: 1px solid var(--aurora-border-color, #e2e8f0);
}

.lalin-validation-item:last-child {
    border-bottom: none;
}

.lalin-validation-item i {
    flex-shrink: 0;
    margin-top: 0.15rem;
    font-size: 1rem;
}

/* Severity levels */
.lalin-validation-info {
    color: #3b82f6;
}

.lalin-validation-info i {
    color: #3b82f6;
}

.lalin-validation-warning {
    color: #d97706;
}

.lalin-validation-warning i {
    color: #f59e0b;
}

.lalin-validation-error {
    color: #dc2626;
}

.lalin-validation-error i {
    color: #ef4444;
}

/* Dark mode severity */
[data-theme-mode="dark"] .lalin-validation-info {
    color: #60a5fa;
}

[data-theme-mode="dark"] .lalin-validation-info i {
    color: #60a5fa;
}

[data-theme-mode="dark"] .lalin-validation-warning {
    color: #fbbf24;
}

[data-theme-mode="dark"] .lalin-validation-warning i {
    color: #fbbf24;
}

[data-theme-mode="dark"] .lalin-validation-error {
    color: #f87171;
}

[data-theme-mode="dark"] .lalin-validation-error i {
    color: #f87171;
}

/* Fallback message */
.lalin-smart-controls-fallback {
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--aurora-text-muted, #94a3b8);
}


/* --------------------------------------------------------------------------
   6.3  LalinAI Bottom Bar (Fixed position trigger)
   -------------------------------------------------------------------------- */

.lalin-ai-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #E53935 0%, #C62828 100%);
    color: #ffffff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.lalin-ai-bar:hover {
    background: linear-gradient(135deg, #C62828 0%, #B71C1C 100%);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}

.lalin-ai-bar i {
    font-size: 1.1rem;
}

.lalin-ai-bar-label {
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Dark mode */
[data-theme-mode="dark"] .lalin-ai-bar {
    background: linear-gradient(135deg, #EF5350 0%, #E53935 100%);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme-mode="dark"] .lalin-ai-bar:hover {
    background: linear-gradient(135deg, #E53935 0%, #C62828 100%);
}

/* --------------------------------------------------------------------------
   6.4  AI Suggestion Chips (Chatbot quick actions)
   -------------------------------------------------------------------------- */

.lalin-ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 0;
}

.lalin-ai-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #E53935;
    background: #FFEBEE;
    border: 1px solid #FFCDD2;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
}

.lalin-ai-chip:hover {
    background: #FFCDD2;
    border-color: #EF9A9A;
    color: #C62828;
    transform: translateY(-1px);
}

.lalin-ai-chip:active {
    transform: translateY(0);
}

.lalin-ai-chip i {
    font-size: 0.85rem;
}

/* Dark mode chips */
[data-theme-mode="dark"] .lalin-ai-chip {
    color: #EF5350;
    background: rgba(229, 57, 53, 0.12);
    border-color: rgba(229, 57, 53, 0.25);
}

[data-theme-mode="dark"] .lalin-ai-chip:hover {
    background: rgba(229, 57, 53, 0.2);
    border-color: rgba(229, 57, 53, 0.4);
    color: #EF9A9A;
}

/* --------------------------------------------------------------------------
   6.5  AI Chat History Sidebar
   -------------------------------------------------------------------------- */

.lalin-ai-history {
    width: 220px;
    flex-shrink: 0;
    border-inline-end: 1px solid var(--aurora-border-color, #e2e8f0);
    overflow-y: auto;
    padding: 0.75rem 0;
}

.lalin-ai-history-item {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--aurora-text-secondary, #64748b);
    text-decoration: none;
    border-radius: 0.375rem;
    margin: 0 0.5rem 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.lalin-ai-history-item:hover {
    background: var(--aurora-primary-light, #FFEBEE);
    color: var(--aurora-text-primary, #1e293b);
}

.lalin-ai-history-item.active {
    background: #FFEBEE;
    color: #E53935;
    font-weight: 500;
}

[data-theme-mode="dark"] .lalin-ai-history-item:hover {
    background: rgba(229, 57, 53, 0.1);
}

[data-theme-mode="dark"] .lalin-ai-history-item.active {
    background: rgba(229, 57, 53, 0.15);
    color: #EF5350;
}

/* Chatbot History Sidebar (inside modal) */
.chatbot-history-sidebar {
    background: var(--aurora-card-bg, #ffffff);
    border-bottom: 1px solid var(--aurora-border-color, #e2e8f0);
    max-height: 200px;
    overflow-y: auto;
}

.chatbot-history-sidebar .chatbot-history-header {
    background: var(--aurora-body-bg, #f8fafc);
}

.chatbot-history-sidebar .chatbot-history-list .chatbot-history-item {
    display: block;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    color: var(--aurora-text-secondary, #64748b);
    text-decoration: none;
    border-radius: 0.375rem;
    margin-bottom: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease;
}

.chatbot-history-sidebar .chatbot-history-list .chatbot-history-item:hover {
    background: var(--aurora-primary-light, #FFEBEE);
    color: var(--aurora-text-primary, #1e293b);
}

[data-theme-mode="dark"] .chatbot-history-sidebar {
    background: var(--aurora-card-bg, #1e1e2d);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme-mode="dark"] .chatbot-history-sidebar .chatbot-history-header {
    background: var(--aurora-body-bg, #1a1a2e);
}

/* Chatbot Suggestion Chips container */
.chatbot-suggestion-chips {
    padding-bottom: 0.5rem;
}

.chatbot-suggestion-chips .lalin-ai-chip {
    font-size: 0.78rem;
}

/* ==========================================================================
   7. Date Range Picker & Quick Actions
   ========================================================================== */

/* --------------------------------------------------------------------------
   7.1  Date Range Picker (Topbar)
   -------------------------------------------------------------------------- */

.lalin-date-range-picker {
    display: flex;
    align-items: center;
}

.lalin-date-range-picker .form-control {
    font-size: 0.8rem;
    padding: 0.3rem 0.625rem;
    border-radius: 0.375rem;
    min-width: 180px;
    background: var(--aurora-card-bg, #ffffff);
    border-color: var(--aurora-border-color, #e2e8f0);
    color: var(--aurora-text-primary, #1e293b);
    cursor: pointer;
}

.lalin-date-range-picker .form-control:focus {
    border-color: #E53935;
    box-shadow: 0 0 0 0.15rem rgba(229, 57, 53, 0.15);
}

.lalin-date-range-picker .form-control::placeholder {
    color: var(--aurora-text-muted, #94a3b8);
    font-size: 0.78rem;
}

/* Dark mode */
[data-theme-mode="dark"] .lalin-date-range-picker .form-control {
    background: var(--custom-white, #1a1a2e);
    border-color: var(--default-border);
    color: var(--default-text-color);
}

[data-theme-mode="dark"] .lalin-date-range-picker .form-control:focus {
    border-color: #EF5350;
    box-shadow: 0 0 0 0.15rem rgba(239, 83, 80, 0.2);
}

/* --------------------------------------------------------------------------
   7.2  Quick Actions Dropdown (Topbar)
   -------------------------------------------------------------------------- */

.lalin-quick-actions .btn {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.3rem 0.75rem;
    border-radius: 0.375rem;
    gap: 0.35rem;
    display: inline-flex;
    align-items: center;
}

.lalin-quick-actions .dropdown-menu {
    min-width: 200px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--aurora-border-color, #e2e8f0);
}

.lalin-quick-actions .dropdown-item {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s ease;
}

.lalin-quick-actions .dropdown-item:hover {
    background: var(--aurora-primary-light, #FFEBEE);
    color: #E53935;
}

.lalin-quick-actions .dropdown-item i {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
    color: var(--aurora-text-muted, #94a3b8);
}

.lalin-quick-actions .dropdown-item:hover i {
    color: #E53935;
}

/* Dark mode */
[data-theme-mode="dark"] .lalin-quick-actions .dropdown-menu {
    background: var(--custom-white);
    border-color: var(--default-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme-mode="dark"] .lalin-quick-actions .dropdown-item {
    color: var(--default-text-color);
}

[data-theme-mode="dark"] .lalin-quick-actions .dropdown-item:hover {
    background: rgba(229, 57, 53, 0.1);
    color: #EF5350;
}

[data-theme-mode="dark"] .lalin-quick-actions .dropdown-item:hover i {
    color: #EF5350;
}

/* ==========================================================================
   8. Search Input Focus Ring — Red Accent
   ========================================================================== */

/* Global search overlay input */
.aurora-search-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.2);
    border-radius: 0.25rem;
}

/* Sidebar search input */
.aurora-sidebar-search-input:focus {
    border-color: var(--aurora-primary, #E53935);
    box-shadow: 0 0 0 0.15rem rgba(229, 57, 53, 0.15);
}

/* Generic form search inputs */
input[type="search"]:focus,
.form-control.search-input:focus {
    border-color: var(--aurora-primary, #E53935);
    box-shadow: 0 0 0 0.15rem rgba(229, 57, 53, 0.15);
}

/* Dark mode search focus */
[data-theme-mode="dark"] .aurora-search-input:focus {
    box-shadow: 0 0 0 2px rgba(239, 83, 80, 0.25);
}

[data-theme-mode="dark"] .aurora-sidebar-search-input:focus {
    border-color: #EF5350;
    box-shadow: 0 0 0 0.15rem rgba(239, 83, 80, 0.25);
}

[data-theme-mode="dark"] input[type="search"]:focus,
[data-theme-mode="dark"] .form-control.search-input:focus {
    border-color: #EF5350;
    box-shadow: 0 0 0 0.15rem rgba(239, 83, 80, 0.25);
}

/* ==========================================================================
   9. Table Standardization — LalinERP Corporate Table Design
   Requirements: 27.1, 27.2, 27.3, 27.4
   ========================================================================== */

/* --------------------------------------------------------------------------
   9.1  Base Table Styling — White background, red header accent, cell padding
   Applied to all .table instances inside .card or .card-body containers.
   -------------------------------------------------------------------------- */

/* White background on all data tables */
.table {
    background-color: var(--aurora-card-bg, #ffffff);
}

/* Table header — red accent bottom border, subtle background */
.table > thead > tr > th,
.table-light {
    background-color: #fafafa;
    color: #374151;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-bottom: 2px solid var(--aurora-primary, #E53935);
    padding: 0.625rem 0.75rem;
}

/* Table body cells — consistent padding */
.table > tbody > tr > td {
    padding: 0.625rem 0.75rem;
    vertical-align: middle;
    font-size: 0.85rem;
    color: var(--aurora-text-primary, #1e293b);
    border-bottom: 1px solid var(--aurora-border-color, #e2e8f0);
}

/* Subtle row hover — light red tint */
.table > tbody > tr:hover {
    background-color: var(--aurora-primary-light, #FFEBEE);
}

/* Striped rows (optional, when .table-striped is used) */
.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(0, 0, 0, 0.015);
}

/* Dark mode table overrides */
[data-theme-mode="dark"] .table {
    background-color: var(--aurora-card-bg, #1e1e2d);
}

[data-theme-mode="dark"] .table > thead > tr > th,
[data-theme-mode="dark"] .table-light {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--default-text-color, #e2e8f0);
    border-bottom-color: var(--aurora-primary, #EF5350);
}

[data-theme-mode="dark"] .table > tbody > tr > td {
    color: var(--default-text-color, #e2e8f0);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme-mode="dark"] .table > tbody > tr:hover {
    background-color: rgba(229, 57, 53, 0.06);
}

/* --------------------------------------------------------------------------
   9.2  Status Badge Pills — Colored pill badges for table status columns
   Standardizes .badge usage in tables for active/paid, pending, overdue, etc.
   -------------------------------------------------------------------------- */

/* Ensure all status badges use pill shape */
.badge[class*="status"],
.aurora-status-draft,
.aurora-status-active,
.aurora-status-approved,
.aurora-status-paid,
.aurora-status-posted,
.aurora-status-pending,
.aurora-status-in_progress,
.aurora-status-overdue,
.aurora-status-rejected,
.aurora-status-cancelled,
.aurora-status-voided,
.aurora-status-sent,
.aurora-status-confirmed,
.aurora-status-completed,
.badge-status-draft,
.badge-status-pending,
.badge-status-active,
.badge-status-approved,
.badge-status-completed,
.badge-status-cancelled,
.badge-status-overdue,
.badge-status-paid {
    display: inline-flex;
    align-items: center;
    padding: 0.25em 0.65em;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 2rem;
    line-height: 1.4;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   9.3  Pagination Controls — Consistent styling with page size selector
   -------------------------------------------------------------------------- */

/* DataTables pagination — red active page */
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--aurora-primary, #E53935) !important;
    border-color: var(--aurora-primary, #E53935) !important;
    color: #ffffff !important;
    border-radius: 0.375rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--aurora-primary-light, #FFEBEE) !important;
    border-color: var(--aurora-primary-light, #FFEBEE) !important;
    color: var(--aurora-primary, #E53935) !important;
    border-radius: 0.375rem;
}

/* Page size selector styling */
.dataTables_wrapper .dataTables_length select {
    border-radius: 0.375rem;
    border-color: var(--aurora-border-color, #e2e8f0);
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--aurora-primary, #E53935);
    box-shadow: 0 0 0 0.15rem rgba(229, 57, 53, 0.15);
}

/* Search input styling */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 0.375rem;
    border-color: var(--aurora-border-color, #e2e8f0);
    padding: 0.25rem 0.625rem;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--aurora-primary, #E53935);
    box-shadow: 0 0 0 0.15rem rgba(229, 57, 53, 0.15);
}

/* Info text styling */
.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem;
    color: var(--aurora-text-muted, #94a3b8);
}

/* Dark mode pagination */
[data-theme-mode="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-theme-mode="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #EF5350 !important;
    border-color: #EF5350 !important;
    color: #ffffff !important;
}

[data-theme-mode="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(229, 57, 53, 0.15) !important;
    border-color: rgba(229, 57, 53, 0.15) !important;
    color: #EF5350 !important;
}

[data-theme-mode="dark"] .dataTables_wrapper .dataTables_length select {
    background: var(--custom-white, #1a1a2e);
    border-color: var(--default-border);
    color: var(--default-text-color);
}

[data-theme-mode="dark"] .dataTables_wrapper .dataTables_filter input {
    background: var(--custom-white, #1a1a2e);
    border-color: var(--default-border);
    color: var(--default-text-color);
}

/* Bootstrap pagination — red active page (for non-DataTable pagination) */
.page-item.active .page-link {
    background-color: var(--aurora-primary, #E53935);
    border-color: var(--aurora-primary, #E53935);
    color: #ffffff;
}

.page-link:hover {
    background-color: var(--aurora-primary-light, #FFEBEE);
    border-color: var(--aurora-primary-light, #FFEBEE);
    color: var(--aurora-primary, #E53935);
}

.page-link:focus {
    box-shadow: 0 0 0 0.15rem rgba(229, 57, 53, 0.15);
}

/* ==========================================================================
   10. Chart Styling Standardization
   Requirements: 28.1, 28.2, 28.3
   ========================================================================== */

/* Chart container — white background, responsive sizing */
.apexcharts-canvas {
    background: transparent;
}

.card .apexcharts-canvas {
    width: 100% !important;
}

/* Ensure chart containers are responsive */
.aurora-chart-container,
[id*="chart"],
[id*="Chart"] {
    width: 100%;
    min-height: 0;
}

/* Clean grid lines */
.apexcharts-gridline {
    stroke: var(--aurora-border-color, #e2e8f0);
    stroke-width: 0.5;
}

/* Readable axis labels */
.apexcharts-xaxis-label,
.apexcharts-yaxis-label {
    fill: var(--aurora-text-muted, #94a3b8);
    font-size: 0.75rem;
}

/* Tooltip styling */
.apexcharts-tooltip {
    border-radius: 0.5rem !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

/* Dark mode chart overrides */
[data-theme-mode="dark"] .apexcharts-gridline {
    stroke: rgba(255, 255, 255, 0.08);
}

[data-theme-mode="dark"] .apexcharts-xaxis-label,
[data-theme-mode="dark"] .apexcharts-yaxis-label {
    fill: var(--text-muted, #94a3b8);
}

[data-theme-mode="dark"] .apexcharts-tooltip {
    background: var(--custom-white, #1e1e2d) !important;
    border-color: var(--default-border) !important;
    color: var(--default-text-color) !important;
}

[data-theme-mode="dark"] .apexcharts-tooltip-title {
    background: var(--default-background, #1a1a2e) !important;
    border-bottom-color: var(--default-border) !important;
}

/* ==========================================================================
   11. Responsive Behavior — LalinERP Specific Breakpoints
   Requirements: 29.1, 29.2
   ========================================================================== */

/* --------------------------------------------------------------------------
   11.1  Below 768px — Sidebar collapses, two-column forms stack
   -------------------------------------------------------------------------- */

@media (max-width: 767.98px) {
    /* Two-column form layouts stack to single column */
    .row > .col-lg-8,
    .row > .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Smart controls sidebar goes full width below form */
    .lalin-smart-controls {
        margin-top: 1rem;
    }

    /* Date range picker: reduce min-width on mobile */
    .lalin-date-range-picker .form-control {
        min-width: 140px;
        font-size: 0.75rem;
    }

    /* Quick actions: smaller button on mobile */
    .lalin-quick-actions .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* AI bottom bar: smaller text on mobile */
    .lalin-ai-bar {
        font-size: 0.78rem;
        padding: 0.4rem 0.75rem;
    }

    /* AI insights panel: full width on mobile */
    .lalin-ai-insights {
        margin-top: 1rem;
    }

    /* Chat history sidebar: collapse on mobile */
    .lalin-ai-history {
        width: 100%;
        border-inline-end: none;
        border-bottom: 1px solid var(--aurora-border-color, #e2e8f0);
        max-height: 150px;
    }
}

/* --------------------------------------------------------------------------
   11.2  Below 576px — KPI cards stack vertically, charts resize
   -------------------------------------------------------------------------- */

@media (max-width: 575.98px) {
    /* KPI cards stack vertically — each card takes full width */
    .row > [class*="col-"][class*="col-sm-6"],
    .row > [class*="col-"][class*="col-md-3"],
    .row > [class*="col-"][class*="col-xl-3"],
    .row > .aurora-kpi-col {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Charts resize to viewport width */
    .apexcharts-canvas {
        max-width: 100% !important;
    }

    .card-body .apexcharts-canvas svg {
        width: 100% !important;
    }

    /* Reduce KPI card padding on small screens */
    .aurora-kpi-hover .card-body {
        padding: 0.75rem;
    }

    /* Status badges: slightly smaller on mobile */
    .badge[class*="status"],
    [class*="aurora-status-"],
    [class*="badge-status-"] {
        font-size: 0.7rem;
        padding: 0.2em 0.5em;
    }

    /* Table font size reduction for readability */
    .table > thead > tr > th {
        font-size: 0.72rem;
        padding: 0.5rem;
    }

    .table > tbody > tr > td {
        font-size: 0.78rem;
        padding: 0.5rem;
    }
}

/* ==========================================================================
   12. RTL Layout Enhancements — Arabic Language Support
   Requirements: 29.3, 4.8, 2.7, 5.7
   ========================================================================== */

/* --------------------------------------------------------------------------
   12.1  Top Bar — Mirror element order for RTL
   -------------------------------------------------------------------------- */

[dir="rtl"] .app-header .header-content-left {
    order: 2;
}

[dir="rtl"] .app-header .header-content-right {
    order: 1;
}

/* Flip the hamburger toggle to right side */
[dir="rtl"] .sidemenu-toggle.header-link {
    margin-inline-start: 0;
    margin-inline-end: auto;
}

/* Quick actions dropdown: align to start in RTL */
[dir="rtl"] .lalin-quick-actions .dropdown-menu {
    text-align: right;
}

[dir="rtl"] .lalin-quick-actions .dropdown-item {
    flex-direction: row-reverse;
}

/* Date range picker: text alignment */
[dir="rtl"] .lalin-date-range-picker .form-control {
    text-align: right;
}

/* --------------------------------------------------------------------------
   12.2  Sidebar — Right side rendering (supplements rtl.css)
   -------------------------------------------------------------------------- */

/* Active item border flips to right side via border-inline-start */
/* Already handled by border-inline-start in section 4 */

/* Sidebar search icon position */
[dir="rtl"] .aurora-sidebar-search-icon {
    left: auto;
    right: 0.6rem;
}

/* --------------------------------------------------------------------------
   12.3  Tables — RTL alignment
   -------------------------------------------------------------------------- */

[dir="rtl"] .table > thead > tr > th {
    text-align: right;
}

[dir="rtl"] .table > tbody > tr > td {
    text-align: right;
}

/* Actions column stays centered */
[dir="rtl"] .table > thead > tr > th:last-child,
[dir="rtl"] .table > tbody > tr > td:last-child {
    text-align: center;
}

/* DataTables pagination: flip chevrons handled by rtl.css */

/* --------------------------------------------------------------------------
   12.4  KPI Cards — RTL layout
   -------------------------------------------------------------------------- */

[dir="rtl"] .aurora-kpi-sparkline {
    right: auto;
    left: 0;
}

/* --------------------------------------------------------------------------
   12.5  AI Components — RTL layout
   -------------------------------------------------------------------------- */

[dir="rtl"] .lalin-insight-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .lalin-insight-content {
    text-align: right;
}

[dir="rtl"] .lalin-insight-content a {
    direction: rtl;
}

[dir="rtl"] .lalin-validation-item {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .lalin-ai-chips {
    direction: rtl;
}

[dir="rtl"] .lalin-ai-chip {
    flex-direction: row-reverse;
}

/* AI bottom bar: RTL */
[dir="rtl"] .lalin-ai-bar {
    flex-direction: row-reverse;
}

/* Chat history sidebar: border flips */
[dir="rtl"] .lalin-ai-history {
    border-inline-end: none;
    border-inline-start: 1px solid var(--aurora-border-color, #e2e8f0);
}

/* --------------------------------------------------------------------------
   12.6  Form Layouts — RTL two-column swap
   -------------------------------------------------------------------------- */

/* Two-column form: sidebar appears on left in RTL (natural flow with dir=rtl) */
/* Bootstrap grid handles this natively with dir="rtl" on <html> */

/* Smart controls sidebar: text alignment */
[dir="rtl"] .lalin-smart-controls .card-title {
    text-align: right;
}

/* --------------------------------------------------------------------------
   12.7  Charts — RTL support
   -------------------------------------------------------------------------- */

/* ApexCharts handles RTL internally via chart.options.chart.defaultLocale */
/* Ensure chart containers don't break in RTL */
[dir="rtl"] .apexcharts-canvas {
    direction: ltr; /* Charts render LTR internally */
}

/* --------------------------------------------------------------------------
   12.8  Pagination — RTL alignment
   -------------------------------------------------------------------------- */

[dir="rtl"] .dataTables_wrapper .dataTables_paginate {
    text-align: left;
}

[dir="rtl"] .dataTables_wrapper .dataTables_info {
    text-align: right;
}

[dir="rtl"] .dataTables_wrapper .dataTables_length {
    text-align: right;
}

[dir="rtl"] .dataTables_wrapper .dataTables_filter {
    text-align: left;
}
