/* ════════════════════════════════════════════════════════════════════
   GLOBAL THEME TOKENS
   ════════════════════════════════════════════════════════════════════
   VAŽNO: ovaj fajl MORA biti uključen globalno (preko App.razor / 
   _Host.cshtml / index.html), NE kao .razor.css scoped — scoped CSS 
   dodaje [b-xyz] atribut svakom selektoru pa <body data-theme="navy">
   ne bi bio pogođen.
   
   Selektor `[data-theme="..."]` postavljamo na <body> iz MyDetails.razor
   (preko JS interop-a) ili iz MainLayout-a (preferred — čita iz TokenStore).
   ════════════════════════════════════════════════════════════════════ */

/* ───────── Default token-i (Navy fallback ako data-theme nije postavljen) ───────── */
:root,
[data-theme="navy"],
.theme-light {
    --color-bg:           #f3f5fa;
    --color-surface:      #ffffff;
    --color-surface-soft: #fafbfd;
    --color-surface-alt:  #e8edf8;
    --color-toprow-surface: #e9edf5;
    --color-field-filled-bg: #f5f7fb;
    --color-border:       #e3e7f0;
    --color-border-soft:  #f0f2f7;
    --color-border-strong:#c8d0e0;
    --color-hover:        #f8f9fc;
    --color-text:         #0f1728;
    --color-text-strong:  #0f1728;
    --color-text-muted:   #5d6679;
    --color-text-soft:    #56657b;
    --color-on-primary:   #ffffff;

    --color-primary:      #1e2e52;
    --color-primary-rgb:  30, 46, 82;
    --color-primary-hover:#16223f;
    --color-primary-soft: #e8edf8;
    --color-primary-text: #ffffff;
    --color-accent:       #f59e0b;
    --color-link:         #006bb7;

    --color-bg-soft:          #f8f9fa;
    --color-app-shell:        #eef0f4;
    --color-topbar:           #253965;
    --color-topbar-text:      #ffffff;
    --color-surface-elevated: #ffffff;
    --color-surface-muted:    #f4f6fb;
    --color-table-header-bg:  #f8f9fa;
    --color-btn-primary:      #1e2e52;
    --color-btn-primary-border:#16223f;
    --color-error-bg:         #fdecec;
    --color-error-border:     #fecaca;
    --color-error-text:       #c53030;
    --modal-backdrop-opacity: .5;

    --color-success:      #16865a;
    --color-success-soft: #e4f5ec;
    --color-success-text: #11704b;
    --color-warning:      #f59e0b;
    --color-warning-soft: #fff5e4;
    --color-warning-text: #9a5b00;
    --color-danger:       #c53030;
    --color-danger-soft:  #fdecec;
    --color-danger-text:  #c53030;
    --color-info:         #2563eb;
    --color-info-soft:    #dbeafe;
    --color-info-text:    #1e40af;

    --status-success-bg:   #e4f5ec;
    --status-success-text: #11704b;
    --status-warning-bg:   #fff5e4;
    --status-warning-text: #9a5b00;
    --status-danger-bg:    #fdecec;
    --status-danger-text:  #c53030;
    --status-info-bg:      #e0f2fe;
    --status-info-text:    #0369a1;

    --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
    --shadow-md: 0 1px 3px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.04);
    --shadow-lg: 0 10px 24px rgba(15,23,42,.10), 0 4px 8px rgba(15,23,42,.05);
    --shadow-floating: 0 10px 24px rgba(37,57,101,.25);
    --shadow-card: var(--shadow-md);
    --focus-ring: 0 0 0 3px rgba(37,57,101,.12);

    --btn-add: var(--color-primary);
    --btn-add-hover: var(--color-primary-hover);
    --btn-save: var(--color-primary);
    --btn-save-hover: var(--color-primary-hover);
    --btn-delete: var(--color-text-muted);
    --btn-delete-hover: var(--color-text);
    --btn-cancel: #6c757d;
    --btn-download: #264653;
    --btn-print: #2a9d8f;
    --btn-edit: #e76f51;
    --btn-export: #059669;
    --btn-refresh: var(--color-primary);
    --btn-refresh-hover: var(--color-primary-hover);
    --btn-refresh-active: var(--color-primary-hover);

    --radius-sm: 6px;
    --radius-md: 9px;
    --radius-lg: 12px;
}

/* ───────── Teal ───────── */
[data-theme="teal"],
.theme-fresh {
    --color-bg:           #f1f7f7;
    --color-surface:      #ffffff;
    --color-surface-soft: #f8fbfb;
    --color-surface-alt:  #e0f2f1;
    --color-border:       #d6e4e4;
    --color-border-soft:  #ecf2f2;
    --color-border-strong:#b8cdcd;
    --color-hover:        #f4f9f9;
    --color-text:         #0f2424;
    --color-text-strong:  #0f2424;
    --color-text-muted:   #4f5f62;
    --color-text-soft:    #63787b;
    --color-on-primary:   #ffffff;

    --color-primary:      #0f766e;
    --color-primary-rgb:  15, 118, 110;
    --color-primary-hover:#115e57;
    --color-primary-soft: #d1f0ec;
    --color-primary-text: #ffffff;
    --color-accent:       #f97316;
    --color-link:         #0369a1;

    --color-bg-soft:          #f1f7f7;
    --color-app-shell:        #eef7f6;
    --color-topbar:           #0f766e;
    --color-topbar-text:      #ffffff;
    --color-surface-elevated: #ffffff;
    --color-surface-muted:    #f1f7f7;
    --color-table-header-bg:  #f1f7f7;
    --color-btn-primary:      #0f766e;
    --color-btn-primary-border:#0b5f59;
    --color-error-bg:         #fde2e2;
    --color-error-border:     #f7b7b7;
    --color-error-text:       #b91c1c;
    --modal-backdrop-opacity: .45;

    --color-success:      #15803d;
    --color-success-soft: #dcfce7;
    --color-success-text: #14532d;
    --color-warning:      #b45309;
    --color-warning-soft: #fef3c7;
    --color-warning-text: #78350f;
    --color-danger:       #b91c1c;
    --color-danger-soft:  #fee2e2;
    --color-danger-text:  #7f1d1d;
    --color-info:         #0369a1;
    --color-info-soft:    #e0f2fe;
    --color-info-text:    #075985;

    --status-success-bg:   #dcfce7;
    --status-success-text: #14532d;
    --status-warning-bg:   #fff0c7;
    --status-warning-text: #92400e;
    --status-danger-bg:    #fde2e2;
    --status-danger-text:  #991b1b;
    --status-info-bg:      #dff1fb;
    --status-info-text:    #075985;

    --shadow-sm: 0 1px 2px rgba(15,68,64,.04);
    --shadow-md: 0 1px 3px rgba(15,68,64,.05), 0 4px 12px rgba(15,68,64,.05);
    --shadow-lg: 0 10px 24px rgba(15,68,64,.10), 0 4px 8px rgba(15,68,64,.05);
    --shadow-floating: 0 10px 24px rgba(15,118,110,.28);
    --shadow-card: var(--shadow-md);
    --focus-ring: 0 0 0 3px rgba(15,118,110,.16);

    --btn-add: #0f766e;
    --btn-add-hover: #0b5f59;
    --btn-save: #15803d;
    --btn-save-hover: #166534;
    --btn-delete: #b91c1c;
    --btn-delete-hover: #991b1b;
    --btn-cancel: #5e6b6e;
    --btn-download: #0369a1;
    --btn-print: #0f766e;
    --btn-edit: #f97316;
    --btn-export: #15803d;
    --btn-refresh: #0369a1;
}

/* ───────── Midnight (dark) ───────── */
[data-theme="midnight"],
.theme-midnight,
.theme-dark {
    --color-bg:           #0d1424;
    --color-surface:      #131c30;
    --color-surface-soft: #18223a;
    --color-surface-alt:  #1d2842;
    --color-field-filled-bg: #1f2b4d;
    --color-border:       #233054;
    --color-border-soft:  #1a2440;
    --color-border-strong:#34457a;
    --color-hover:        #18223a;
    --color-text:         #e5ebf5;
    --color-text-strong:  #ffffff;
    --color-text-muted:   #a5b0c9;
    --color-text-soft:    #94a3c2;
    --color-on-primary:   #0d1424;

    --color-primary:      #6e8cd9;
    --color-primary-rgb:  110, 140, 217;
    --color-primary-hover:#88a3e8;
    --color-primary-soft: #1f2b4d;
    --color-primary-text: #0d1424;
    --color-accent:       #fbbf24;
    --color-link:         #8fb3ff;

    --color-bg-soft:          #111b2f;
    --color-app-shell:        #0b1220;
    --color-topbar:           #0d1424;
    --color-topbar-text:      #e5ebf5;
    --color-surface-elevated: #17233b;
    --color-surface-muted:    #1f2b4d;
    /* Table column-filter fields (inputs and multi-value triggers); was only defined for light themes. */
    --color-toprow-surface:   var(--color-surface-muted);
    --color-table-header-bg:  #111b2f;
    --color-btn-primary:      #6e8cd9;
    --color-btn-primary-border:#8aa6e8;
    --color-error-bg:         rgba(248,113,113,.12);
    --color-error-border:     rgba(248,113,113,.35);
    --color-error-text:       #fca5a5;
    --modal-backdrop-opacity: .65;

    --color-success:      #4ade80;
    --color-success-soft: #173c2a;
    --color-success-text: #86efac;
    --color-warning:      #fbbf24;
    --color-warning-soft: #3d2e10;
    --color-warning-text: #fde68a;
    --color-danger:       #f87171;
    --color-danger-soft:  #3d1717;
    --color-danger-text:  #fca5a5;
    --color-info:         #60a5fa;
    --color-info-soft:    #16284c;
    --color-info-text:    #93c5fd;

    --status-success-bg:   #173c2a;
    --status-success-text: #86efac;
    --status-warning-bg:   rgba(255,191,36,.18);
    --status-warning-text: #fde68a;
    --status-danger-bg:    rgba(248,113,113,.16);
    --status-danger-text:  #fecaca;
    --status-info-bg:      rgba(96,165,250,.16);
    --status-info-text:    #93c5fd;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.30);
    --shadow-md: 0 1px 3px rgba(0,0,0,.30), 0 4px 12px rgba(0,0,0,.25);
    --shadow-lg: 0 10px 24px rgba(0,0,0,.40), 0 4px 8px rgba(0,0,0,.20);
    --shadow-floating: 0 10px 24px rgba(0,0,0,.45);
    --shadow-card: var(--shadow-md);
    --focus-ring: 0 0 0 3px rgba(110,140,217,.20);

    --btn-add: #22c55e;
    --btn-add-hover: #16a34a;
    --btn-save: #4ade80;
    --btn-save-hover: #22c55e;
    --btn-delete: #ef4444;
    --btn-delete-hover: #dc2626;
    --btn-cancel: #64748b;
    --btn-download: #60a5fa;
    --btn-print: #38bdf8;
    --btn-edit: #fbbf24;
    --btn-export: #4ade80;
    --btn-refresh: #60a5fa;
}

/* Body fallback boja u skladu sa temom */
body[data-theme] {
    background: var(--color-bg);
    color: var(--color-text);
    transition: background .25s ease, color .25s ease;
}
