/* Modern Design System - LimraSoft */
/*@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');*/

:root {
    /* Color Palette */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #64748b;
    --secondary-hover: #475569;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    /* Backgrounds */
    --background: #f1f5f9;
    /* Slate 100 */
    --surface: #ffffff;
    --sidebar-bg: #141414;
    /* Black */
    /* Text */
    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */
    --text-on-dark: #f8fafc;
    /* Borders */
    --border-color: #e2e8f0;
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
/* Spacing */
/* Layout metrics (--header-height, --sidebar-width, radii, elevation) now
   live in css/tokens.css, which loads after this file. The 64px/260px values
   that used to be declared here were never consumed by any component. */
}

[data-theme="dark"] {
    /* Color Palette - Unchanged or adjusted for dark contrast if needed */
    /* Backgrounds */
    --background: #000000;
    /* Darker background for dark mode */
    --surface: #1e1e1e;
    /* Dark surface */
    --sidebar-bg: #141414;
    /* Keep it black as requested */
    /* Text */
    --text-main: #f8fafc;
    /* Light text */
    --text-muted: #94a3b8;
    /* Lighter muted text */
    /* Borders */
    --border-color: #334155;
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(255 255 255 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(255 255 255 / 0.1), 0 2px 4px -2px rgb(255 255 255 / 0.1);
}

html,
body {
    font-family: var(--font-family);
    color: var(--text-main);
    background-color: var(--background);
    margin: 0;
    padding: 0;
    font-size: var(--fs-base);
    /* Slight bump for readability */
}

/* Global Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 10px;
    border: 2px solid var(--background);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-hover);
}

/* Common Components */
a,
.btn-link {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover,
.btn-link:hover {
    color: var(--primary-hover);
}

/* Button Overrides */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem var(--primary-light);
    border-color: var(--primary);
}

/* Typography Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--text-main);
}

/* Cards */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}



/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success);
}

.invalid {
    outline: 1px solid var(--danger);
}

.validation-message {
    color: var(--danger);
    font-size: 0.875rem;
}

/* Darker checkbox border */
.darker-border-checkbox.form-check-input {
    border-color: var(--secondary);
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}



/* =========================================
   TABLES / QUICKGRID
   Dark-mode tables are themed through Bootstrap's --bs-table-*
   variables in tokens.css (section 4), which covers all 252
   <QuickGrid Class="table ..."> pages. The previous ~70 lines of
   [data-theme="dark"] table.quickgrid { ... !important } overrides
   were removed because they fought Bootstrap's own cascade.
   ========================================= */
[data-theme="dark"] table.quickgrid .sort-indicator {
    filter: brightness(1.2);
}

[data-theme="dark"] table.quickgrid .action-btn {
    border-radius: var(--radius);
}

/* Inputs keep a light background in both themes (--input-bg is #fff),
   so their text colour must come from the input token — otherwise dark
   mode renders near-white text on a white control. */
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
    color: var(--input-color);
    background-color: var(--input-bg);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--input-placeholder);
}


/*===================================================================*/
.status-badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: transform .2s ease, box-shadow .2s ease;
}

    .status-badge:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    }

.btn-remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #dc3545;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    z-index: 10;
}

    .btn-remove-image:hover {
        background: #dc3545;
        color: white;
        transform: scale(1.1);
    }


/* =========================================
   MODERN CHECKBOX (Global)
   Applies to every checkbox in the project.
   Bootstrap switches (.form-switch) are excluded.
========================================= */
input[type="checkbox"]:not(:where(.form-switch *)) {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
    vertical-align: middle;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    background-color: var(--surface, #fff);
    background-image: none;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.25s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

[data-theme="dark"] input[type="checkbox"]:not(:where(.form-switch *)) {
    border-color: #52525b;
    background-color: #27272a;
}

/* Hover */
input[type="checkbox"]:not(:where(.form-switch *)):hover:not(:disabled) {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* Focus */
input[type="checkbox"]:not(:where(.form-switch *)):focus-visible {
    outline: none;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.22);
}

input[type="checkbox"]:not(:where(.form-switch *)):focus:not(:focus-visible) {
    outline: none;
}

/* Active press */
input[type="checkbox"]:not(:where(.form-switch *)):active:not(:disabled) {
    transform: scale(0.9);
}

/* Checkmark */
input[type="checkbox"]:not(:where(.form-switch *))::after {
    content: "";
    position: absolute;
    top: 46%;
    left: 50%;
    width: 5px;
    height: 10px;
    margin-top: -1px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(0.4);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.12s ease;
}

/* Checked state - gradient fill + pop animation */
input[type="checkbox"]:not(:where(.form-switch *)):checked {
    border-color: transparent;
    background-color: var(--primary, #2563eb);
    background-image: linear-gradient(135deg, var(--primary, #2563eb), #7b5cf0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

input[type="checkbox"]:not(:where(.form-switch *)):checked::after {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(45deg) scale(1);
}

/* Indeterminate state - dash */
input[type="checkbox"]:not(:where(.form-switch *)):indeterminate {
    border-color: transparent;
    background-image: linear-gradient(135deg, var(--primary, #2563eb), #7b5cf0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

input[type="checkbox"]:not(:where(.form-switch *)):indeterminate::after {
    content: "";
    top: 50%;
    left: 50%;
    width: 11px;
    height: 2.5px;
    margin-top: 0;
    border: none;
    border-radius: 2px;
    opacity: 1;
    background: #fff;
    transform: translate(-50%, -50%) scale(1);
}

/* Disabled */
input[type="checkbox"]:not(:where(.form-switch *)):disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.6);
}

label,
.form-label {
    font-size: 0.975rem;
    font-weight: 600;
}

/* Label alignment */
.form-check-label,
label[for] {
    cursor: pointer;
    vertical-align: middle;
}


/* =========================================
   ACTIONS ROW (Global system)
   New / Save / Back buttons row for all
   Add & Edit pages. Responsive by default.
========================================= */
.actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 0.75rem;
}

.actions-row > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 110px;
    height: 42px !important;
    padding-inline: 18px;
}

/* Save buttons: distinct ERP green (#16A34A), darker on hover/active.
   Used by master-data forms instead of Bootstrap btn-success. */
.btn-save {
    background-color: #16A34A;
    border-color: #16A34A;
    color: #fff;
}

.btn-save:hover,
.btn-save:focus {
    background-color: #15803d;
    border-color: #15803d;
    color: #fff;
}

.btn-save:active {
    background-color: #166534;
    border-color: #166534;
    color: #fff;
}

/* Secondary / back / cancel buttons: slate grey (#64748B),
   white text, darker on hover. Used for New/Back actions. */
.btn-back {
    background-color: #64748B;
    border-color: #64748B;
    color: #fff;
}

.btn-back:hover,
.btn-back:focus {
    background-color: #475569;
    border-color: #475569;
    color: #fff;
}

.btn-back:active {
    background-color: #334155;
    border-color: #334155;
    color: #fff;
}

/* =========================================
   FORM SWITCHES (master-data IsActive rows)
   Bigger switch + label pinned next to it in both RTL/LTR.
   flex replaces Bootstrap's float mechanics, so direction
   never breaks the alignment. No markup changes needed.
   ========================================= */
.form-check.form-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 2.75rem;
    padding-left: 0;
    margin-bottom: 0;
}

.form-check.form-switch .form-check-input {
    float: none;
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
    width: 3.25em;
    height: 1.75em;
    flex: 0 0 auto;
    cursor: pointer;
}

.form-check.form-switch .form-check-label {
    font-size: 1.1rem;
    cursor: pointer;
}

/* Phones: stack full-width */
@media (max-width: 575px) {
    .actions-row > .btn {
        flex: 1 1 100%;
        width: 100% !important;
        min-width: 0;
        height: 44px !important;
        margin: 0 !important;
    }
}

/* =========================================
   GLASS CARD SYSTEM (master-data forms)
   Used by CountryDbAddEditPage pattern and all coding screens.
   Theme-aware via --surface / --border-color / --text-main.
   ========================================= */
.glass {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
}

.fade-in {
    animation: fade-in .35s ease;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fade-in {
        animation: none;
    }
}


