/**
 * Public pages theme bridge.
 *
 * Le pagine pubbliche (welcome, auth) usano Bootstrap 5, mentre il pannello
 * admin usa il tema Tabler con colori custom definiti in resources/css/colors.css.
 * Questo file mappa le variabili CSS di Bootstrap sui colori del tema,
 * così le pagine pubbliche rispettano la stessa palette (primary #7c69ef).
 */

:root,
[data-bs-theme=light] {
    --bs-primary: #7c69ef;
    --bs-primary-rgb: 124, 105, 239;
    --bs-secondary: #66626c;
    --bs-secondary-rgb: 102, 98, 108;
    --bs-success: #42ba96;
    --bs-success-rgb: 66, 186, 150;
    --bs-info: #467fd0;
    --bs-info-rgb: 70, 127, 208;
    --bs-warning: #ffc107;
    --bs-warning-rgb: 255, 193, 7;
    --bs-danger: #df4759;
    --bs-danger-rgb: 223, 71, 89;
    --bs-light: #f8fafc;
    --bs-light-rgb: 248, 250, 252;
    --bs-dark: #241f2d;
    --bs-dark-rgb: 36, 31, 45;

    --bs-body-bg: #f1f5f9;
    --bs-body-bg-rgb: 241, 245, 249;
    --bs-body-color: #241f2d;
    --bs-body-color-rgb: 36, 31, 45;
    --bs-emphasis-color: #000;
    --bs-emphasis-color-rgb: 0, 0, 0;
    --bs-secondary-color: rgba(36, 31, 45, 0.75);
    --bs-secondary-color-rgb: 36, 31, 45;
    --bs-tertiary-color: rgba(36, 31, 45, 0.5);
    --bs-tertiary-color-rgb: 36, 31, 45;

    --bs-link-color: #7c69ef;
    --bs-link-color-rgb: 124, 105, 239;
    --bs-link-hover-color: #6354bf;
    --bs-link-hover-color-rgb: 99, 84, 191;

    --bs-border-color: #e7e6e7;

    --bs-primary-text-emphasis: #322a60;
    --bs-primary-bg-subtle: #e5e1fc;
    --bs-primary-border-subtle: #cbc3f9;
    --bs-secondary-text-emphasis: #42444b;
    --bs-secondary-bg-subtle: #edeef1;
    --bs-secondary-border-subtle: #dbdde4;
    --bs-success-text-emphasis: #1a4a3c;
    --bs-success-bg-subtle: #d9f1ea;
    --bs-success-border-subtle: #b3e3d5;
    --bs-info-text-emphasis: #1c3353;
    --bs-info-bg-subtle: #dae5f6;
    --bs-info-border-subtle: #b5ccec;
    --bs-warning-text-emphasis: #664d03;
    --bs-warning-bg-subtle: #fff3cd;
    --bs-warning-border-subtle: #ffe69c;
    --bs-danger-text-emphasis: #591c24;
    --bs-danger-bg-subtle: #f9dade;
    --bs-danger-border-subtle: #f2b5bd;
    --bs-light-text-emphasis: #333152;
    --bs-light-bg-subtle: #f8fafc;
    --bs-light-border-subtle: #e2e8f0;
    --bs-dark-text-emphasis: #333152;
    --bs-dark-bg-subtle: #a09bbe;
    --bs-dark-border-subtle: #736c91;

    --bs-focus-ring-color: rgba(124, 105, 239, 0.25);
}

[data-bs-theme=dark] {
    --bs-body-bg: #181818;
    --bs-body-bg-rgb: 24, 24, 24;
    --bs-body-color: #c9c1d6;
    --bs-body-color-rgb: 201, 193, 214;
    --bs-emphasis-color: #fff;
    --bs-emphasis-color-rgb: 255, 255, 255;
    --bs-secondary-color: rgba(201, 193, 214, 0.75);
    --bs-secondary-color-rgb: 201, 193, 214;
    --bs-tertiary-color: rgba(201, 193, 214, 0.5);
    --bs-tertiary-color-rgb: 201, 193, 214;

    --bs-link-color: #b0a5f5;
    --bs-link-color-rgb: 176, 165, 245;
    --bs-link-hover-color: #c0b7f7;
    --bs-link-hover-color-rgb: 192, 183, 247;

    --bs-border-color: #20202b;

    --bs-primary-text-emphasis: #b0a5f5;
    --bs-primary-bg-subtle: #191530;
    --bs-primary-border-subtle: #383243;
    --bs-secondary-text-emphasis: #cacdd6;
    --bs-secondary-bg-subtle: #212225;
    --bs-secondary-border-subtle: #646770;
    --bs-success-text-emphasis: #8ed6c0;
    --bs-success-bg-subtle: #0d251e;
    --bs-success-border-subtle: #28705a;
    --bs-info-text-emphasis: #90b2e3;
    --bs-info-bg-subtle: #0e192a;
    --bs-info-border-subtle: #2a4c7d;
    --bs-warning-text-emphasis: #ffda6a;
    --bs-warning-bg-subtle: #332701;
    --bs-warning-border-subtle: #997404;
    --bs-danger-text-emphasis: #ec919b;
    --bs-danger-bg-subtle: #2d0e12;
    --bs-danger-border-subtle: #862b35;
    --bs-light-text-emphasis: #f1f5f9;
    --bs-light-bg-subtle: #211d3b;
    --bs-light-border-subtle: #29272f;
    --bs-dark-text-emphasis: #c8d3e1;
    --bs-dark-bg-subtle: #110f1e;
    --bs-dark-border-subtle: #211d3b;
}

/* Bottone primario (login, submit lead) */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #7c69ef;
    --bs-btn-border-color: #7c69ef;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #6354bf;
    --bs-btn-hover-border-color: #6354bf;
    --bs-btn-focus-shadow-rgb: 124, 105, 239;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #6354bf;
    --bs-btn-active-border-color: #6354bf;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #7c69ef;
    --bs-btn-disabled-border-color: #7c69ef;
}

/* Bottone outline primario (lang switcher, CTA contatti) */
.btn-outline-primary {
    --bs-btn-color: #7c69ef;
    --bs-btn-border-color: #7c69ef;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #7c69ef;
    --bs-btn-hover-border-color: #7c69ef;
    --bs-btn-focus-shadow-rgb: 124, 105, 239;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #7c69ef;
    --bs-btn-active-border-color: #7c69ef;
    --bs-btn-disabled-color: #7c69ef;
    --bs-btn-disabled-border-color: #7c69ef;
}

/* Focus dei campi form sul colore primario */
.form-control:focus,
.form-check-input:focus,
.form-select:focus {
    border-color: #7c69ef;
    box-shadow: 0 0 0 0.25rem rgba(124, 105, 239, 0.25);
}

.form-check-input:checked {
    background-color: #7c69ef;
    border-color: #7c69ef;
}

/* Superfici (sezioni e card) nel tema scuro */
[data-bs-theme=dark] .bg-white,
[data-bs-theme=dark] .bg-light {
    background-color: #221e26 !important;
}

/* Icone del toggle tema: luna in chiaro, sole in scuro */
.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: inline-block;
}

[data-bs-theme=dark] .theme-toggle .icon-sun {
    display: inline-block;
}

[data-bs-theme=dark] .theme-toggle .icon-moon {
    display: none;
}

/* Toggler navbar nel tema scuro */
[data-bs-theme=dark] .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='m4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Bottone outline secondario (toggle tema) nel tema scuro */
[data-bs-theme=dark] .btn-outline-secondary {
    --bs-btn-color: #c9c1d6;
    --bs-btn-border-color: #4b5563;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #374151;
    --bs-btn-hover-border-color: #4b5563;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #4b5563;
    --bs-btn-active-border-color: #4b5563;
}
