/* =====================================================================
   ALI Intranet – Design System  (ispirato ad aliautonomie.it)
   ===================================================================== */

/* ----- Custom properties ------------------------------------------- */
:root {
    /* Brand ALI */
    --ali-red:         #d91e18;   /* rosso istituzionale */
    --ali-red-dark:    #b01510;
    --ali-navy:        #0d1b35;   /* navy scuro (footer / accenti) */
    --ali-blue:        #003f88;   /* blu istituzionale (tabelle, bottoni) */
    --ali-blue-mid:    #0057b8;
    --ali-blue-light:  #e8f0fb;

    /* 4 colori valori (striscia decorativa) */
    --val-green:       #4caf50;
    --val-blue:        #2196f3;
    --val-lblue:       #03a9f4;
    --val-dgreen:      #388e3c;

    --surface:         #ffffff;
    --bg:              #f2f4f7;
    --border:          #dde3ec;

    --text-primary:    #0d1b35;
    --text-secondary:  #4a5a72;
    --text-muted:      #8898aa;

    --radius-sm:       5px;
    --radius-md:       10px;
    --radius-lg:       14px;

    --shadow-xs:       0 1px 3px rgba(0,0,0,.07);
    --shadow-sm:       0 2px 8px rgba(0,0,0,.10);
    --shadow-md:       0 4px 18px rgba(0,0,0,.13);

    --transition:      all .18s ease;

    --font:            'Inter', system-ui, -apple-system, sans-serif;
}

/* ----- Reset & base ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

body > form {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ----- Header ------------------------------------------------------ */
header {
    background: #fff;
    padding: 12px 0 10px;
    width: 100%;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

header .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 20px;
}

header img {
    max-height: 64px;
    width: auto;
}

/* Badge "INTRANET" accanto al logo */
.header-badge {
    background: var(--ali-red);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 3px;
    align-self: flex-end;
    margin-bottom: 4px;
    margin-left: -4px;
}

/* ----- Striscia 4 valori istituzionali ----------------------------- */
.values-strip {
    display: flex;
    height: 5px;
    width: 100%;
}
.values-strip span {
    flex: 1;
    display: block;
}
.vs-1 { background: var(--val-green); }
.vs-2 { background: var(--val-blue); }
.vs-3 { background: var(--val-lblue); }
.vs-4 { background: var(--val-dgreen); }

/* ----- Navbar ------------------------------------------------------ */
nav.navbar {
    background: #fff;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.navbar-brand {
    color: var(--ali-navy) !important;
    font-weight: 800;
    font-size: .88rem;
    letter-spacing: .3px;
    transition: var(--transition);
}
.navbar-brand:hover { color: var(--ali-red) !important; }

/* Nav links */
nav.navbar .nav-link {
    color: var(--text-primary) !important;
    font-weight: 600;
    font-size: .84rem;
    padding: 14px 13px !important;
    transition: var(--transition);
    letter-spacing: .1px;
    border-bottom: 3px solid transparent;
    border-radius: 0;
}

nav.navbar .nav-link:hover,
nav.navbar .nav-link:focus {
    color: var(--ali-red) !important;
    border-bottom-color: var(--ali-red);
}

nav.navbar .nav-item.active .nav-link,
nav.navbar .nav-link.active {
    color: var(--ali-red) !important;
    border-bottom-color: var(--ali-red);
}

/* Dropdown */
.navbar .dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--ali-red);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 230px;
    padding: 6px 0;
    margin-top: 0 !important;
}

.navbar .dropdown-item {
    font-size: .84rem;
    font-weight: 500;
    color: var(--text-primary);
    padding: 9px 18px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 9px;
}

.navbar .dropdown-item i {
    width: 16px;
    color: var(--ali-red);
    font-size: .8rem;
}

.navbar .dropdown-item:hover {
    background: #fdf1f1;
    color: var(--ali-red);
    padding-left: 22px;
}

.navbar .dropdown-divider {
    border-color: var(--border);
    margin: 4px 0;
}

/* Toggler (mobile) */
.navbar-toggler {
    border-color: var(--border);
}
.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='%230d1b35' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Login / Logout link — rosso */
nav.navbar .nav-link.nav-link-action {
    color: var(--ali-red) !important;
    border: 1.5px solid var(--ali-red);
    border-radius: var(--radius-sm);
    padding: 7px 14px !important;
    margin-left: 6px;
    font-weight: 700;
    font-size: .8rem;
    border-bottom: 1.5px solid var(--ali-red) !important;
}
nav.navbar .nav-link.nav-link-action:hover {
    background: var(--ali-red);
    color: #fff !important;
    border-bottom-color: var(--ali-red) !important;
}

/* ----- Footer ------------------------------------------------------ */
.site-footer {
    background: var(--ali-navy);
    color: rgba(255,255,255,.65);
    padding: 28px 32px;
    margin-top: auto;
    border-top: 4px solid var(--ali-red);
}

.site-footer .footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
}

.site-footer img {
    max-height: 48px;
    opacity: .85;
    filter: brightness(0) invert(1);
}

.site-footer .footer-copy {
    font-size: .78rem;
    letter-spacing: .2px;
}

.site-footer .footer-copy strong {
    color: #fff;
    display: block;
    font-size: .82rem;
    margin-bottom: 2px;
}

.footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: rgba(255,255,255,.5);
    font-size: .75rem;
    text-decoration: none;
    transition: var(--transition);
}
.footer-links a:hover { color: #fff; }

/* ----- Main content area ------------------------------------------- */
main.page-main {
    flex: 1;
    padding: 20px 24px 32px;
    background: var(--bg);
    min-width: 0;   /* evita overflow su flex */
}

/* Page-level content wrapper used by each .aspx page */
.page-content {
    width: 100%;
    min-width: 0;
}

/* ----- Page header bar --------------------------------------------- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.page-header-left {}

.page-header .page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ali-blue);
    margin: 0 0 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header .page-title i {
    font-size: 1rem;
    color: var(--ali-gold);
}

.page-header .page-subtitle {
    font-size: .82rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ----- Search / filter card ---------------------------------------- */
.search-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.search-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--ali-blue-light);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}

.search-card-header:hover { background: #dde8f7; }

.search-card-title {
    font-size: .88rem;
    font-weight: 700;
    color: var(--ali-blue);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.search-card-toggle {
    font-size: .75rem;
    color: var(--text-secondary);
    transition: transform .2s;
}

.search-card-header.collapsed .search-card-toggle {
    transform: rotate(-90deg);
}

.search-card-body {
    padding: 20px;
}

/* ----- Results bar ------------------------------------------------- */
.results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.results-count {
    font-size: .82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.results-count strong {
    color: var(--ali-blue);
    font-weight: 700;
}

/* ----- Page header / titles ---------------------------------------- */
.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ali-blue);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: .88rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

h2, h3, h4 {
    color: var(--ali-blue);
    font-weight: 700;
}

h2 { font-size: 1.35rem; margin-bottom: 18px; }
h3 { font-size: 1.1rem; margin-bottom: 14px; }

/* ----- Cards -------------------------------------------------------- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    background: var(--surface);
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-sm); }

.card-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--ali-blue);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--ali-red);
    border-radius: 4px;
    flex-shrink: 0;
}

.container-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

/* ----- Section titles ---------------------------------------------- */
.section-title {
    background: #fdf1f1;
    color: var(--ali-navy);
    font-weight: 700;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: .9rem;
    border-left: 4px solid var(--ali-red);
    letter-spacing: .2px;
}

/* ----- Forms ------------------------------------------------------- */
label {
    font-weight: 600;
    font-size: .82rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 4px;
    display: block;
}

.form-control,
.form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .88rem;
    color: var(--text-primary);
    padding: 8px 12px;
    background: var(--surface);
    transition: var(--transition);
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ali-blue-mid);
    box-shadow: 0 0 0 3px rgba(0,87,184,.15);
    outline: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-group { margin-bottom: 16px; }

/* ----- Buttons ----------------------------------------------------- */
.btn {
    font-size: .84rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    letter-spacing: .2px;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--ali-blue);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,63,136,.28);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--ali-blue-mid);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,63,136,.33);
}

.btn-brand {
    background: var(--ali-red);
    color: #fff;
    box-shadow: 0 2px 6px rgba(217,30,24,.28);
}
.btn-brand:hover, .btn-brand:focus {
    background: var(--ali-red-dark);
    color: #fff;
}

.btn-success {
    background: #1a7f4b;
    color: #fff;
    box-shadow: 0 2px 6px rgba(26,127,75,.25);
}
.btn-success:hover {
    background: #158a40;
    color: #fff;
}

.btn-info {
    background: #0090b5;
    color: #fff;
}
.btn-info:hover { background: #007a9a; color: #fff; }

.btn-warning {
    background: var(--ali-gold);
    color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(232,160,32,.25);
}
.btn-warning:hover { background: #d4901a; color: var(--text-primary); }

.btn-danger {
    background: #c0392b;
    color: #fff;
}
.btn-danger:hover { background: #a93226; color: #fff; }

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: #cbd5e1; color: var(--text-primary); }

.btn-outline-primary {
    background: transparent;
    color: var(--ali-blue);
    border: 1.5px solid var(--ali-blue);
}
.btn-outline-primary:hover {
    background: var(--ali-blue);
    color: #fff;
}

.btn-sm {
    font-size: .78rem;
    padding: 5px 12px;
}

.btn-lg {
    font-size: .95rem;
    padding: 11px 28px;
}

/* ----- Tables ------------------------------------------------------ */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .84rem;
}

.table thead th {
    background: var(--ali-blue);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    text-align: left;
    padding: 11px 14px;
    letter-spacing: .5px;
    text-transform: uppercase;
    border: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.gridview-header {
    background-color: #1a3a5c !important;
    color: #fff !important;
}
.gridview-header a,
.gridview-header a:link,
.gridview-header a:visited {
    color: #fff !important;
    text-decoration: none !important;
    font-weight: bold !important;
}
.gridview-header a:hover {
    color: #add8e6 !important;
}
#longProcessMessage {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ffc107;
    color: #000;
    padding: 10px;
    border-radius: 5px;
    z-index: 1000;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.table thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.table thead th a,
.table thead th a:visited {
    color: #fff !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.table thead th a:hover { color: var(--ali-gold) !important; }

.table tbody tr {
    border-bottom: 1px solid #edf1f7;
    transition: background .12s;
}

.table tbody tr:hover { background: var(--ali-blue-light); }

.table td {
    padding: 9px 14px;
    vertical-align: middle;
    color: var(--text-primary);
}

/* Centered columns helper */
.table td.text-center,
.table th.text-center { text-align: center; }

.table-striped tbody tr:nth-of-type(odd) { background: #f8fafc; }
.table-striped tbody tr:nth-of-type(odd):hover { background: var(--ali-blue-light); }

.table-bordered {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* Wrapper per tabelle scrollabili */
.table-responsive {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    overflow: auto;
}

/* ----- Badges ------------------------------------------------------ */
.badge {
    font-size: .72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: .3px;
}

.badge-success, .bg-success { background: #dcfce7 !important; color: #166534 !important; }
.badge-danger,  .bg-danger  { background: #fee2e2 !important; color: #991b1b !important; }
.badge-warning, .bg-warning { background: var(--ali-gold-light) !important; color: #92400e !important; }
.badge-info,    .bg-info    { background: #e0f2fe !important; color: #0c4a6e !important; }
.badge-primary, .bg-primary { background: var(--ali-blue-light) !important; color: var(--ali-blue) !important; }
.badge-secondary            { background: #f1f5f9 !important; color: var(--text-secondary) !important; }

/* ----- Alerts ------------------------------------------------------ */
.alert {
    border-radius: var(--radius-md);
    border: none;
    padding: 12px 16px;
    font-size: .86rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success  { background: #dcfce7; color: #166534; }
.alert-danger   { background: #fee2e2; color: #991b1b; }
.alert-warning  { background: var(--ali-gold-light); color: #92400e; }
.alert-info     { background: #e0f2fe; color: #0c4a6e; }

/* ----- Modals ------------------------------------------------------ */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.modal-header {
    background: var(--ali-blue);
    color: #fff;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    padding: 14px 20px;
}

.modal-header .modal-title {
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .2px;
}

.modal-header .btn-close { filter: invert(1); }

.table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.table thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.table thead th a,
.table thead th a:visited {
    color: #fff !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.table thead th a:hover { color: var(--ali-gold) !important; }

.table tbody tr {
    border-bottom: 1px solid #edf1f7;
    transition: background .12s;
}

.table tbody tr:hover { background: var(--ali-blue-light); }

.table td {
    padding: 9px 14px;
    vertical-align: middle;
    color: var(--text-primary);
}

/* Centered columns helper */
.table td.text-center,
.table th.text-center { text-align: center; }

.table-striped tbody tr:nth-of-type(odd) { background: #f8fafc; }
.table-striped tbody tr:nth-of-type(odd):hover { background: var(--ali-blue-light); }

.table-bordered {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* Wrapper per tabelle scrollabili */
.table-responsive {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    overflow: auto;
}

/* ----- Badges ------------------------------------------------------ */
.badge {
    font-size: .72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: .3px;
}

.badge-success, .bg-success { background: #dcfce7 !important; color: #166534 !important; }
.badge-danger,  .bg-danger  { background: #fee2e2 !important; color: #991b1b !important; }
.badge-warning, .bg-warning { background: var(--ali-gold-light) !important; color: #92400e !important; }
.badge-info,    .bg-info    { background: #e0f2fe !important; color: #0c4a6e !important; }
.badge-primary, .bg-primary { background: var(--ali-blue-light) !important; color: var(--ali-blue) !important; }
.badge-secondary            { background: #f1f5f9 !important; color: var(--text-secondary) !important; }

/* ----- Alerts ------------------------------------------------------ */
.alert {
    border-radius: var(--radius-md);
    border: none;
    padding: 12px 16px;
    font-size: .86rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success  { background: #dcfce7; color: #166534; }
.alert-danger   { background: #fee2e2; color: #991b1b; }
.alert-warning  { background: var(--ali-gold-light); color: #92400e; }
.alert-info     { background: #e0f2fe; color: #0c4a6e; }

/* ----- Modals ------------------------------------------------------ */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.modal-header {
    background: var(--ali-blue);
    color: #fff;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    padding: 14px 20px;
}

.modal-header .modal-title {
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .2px;
}

.modal-header .btn-close { filter: invert(1); }

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    gap: 8px;
}

/* Custom modal (non-Bootstrap) */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 1050;
    inset: 0;
    background: rgba(10,20,40,.45);
    backdrop-filter: blur(2px);
}

.custom-modal-content {
    background: var(--surface);
    margin: 8% auto;
    padding: 0;
    border-radius: var(--radius-lg);
    width: min(560px, 95vw);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.custom-modal-header {
    background: var(--ali-blue);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-modal-title { margin: 0; font-size: .95rem; font-weight: 700; }

.close-modal {
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}
.close-modal:hover { color: #fff; }

.custom-modal-body {
    padding: 20px;
}

.custom-modal-body label {
    display: block;
    margin: 12px 0 4px;
}

.custom-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.error-message { color: #c0392b; font-size: .8rem; margin-top: 2px; }

/* ----- Spinner / loading ------------------------------------------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.65);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border { color: var(--ali-blue); }

/* ----- Toast / process message ------------------------------------- */
#longProcessMessage {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--ali-blue);
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    z-index: 1000;
    font-size: .84rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid var(--ali-gold);
}

/* ----- Utility classes --------------------------------------------- */
.text-primary { color: var(--ali-blue) !important; }
.text-muted   { color: var(--text-muted) !important; }

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ----- GridView (ASP.NET) ------------------------------------------ */
.gridview-header,
thead.gridview-header,
tr.gridview-header,
.gridview-header th,
table tr.gridview-header th {
    background-color: #1a3a5c !important;
    color: #fff !important;
}

.gridview-header,
.gridview-header a,
.gridview-header a:link,
.gridview-header a:visited {
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.gridview-header a:hover { color: var(--ali-gold) !important; }

/* GridView pager */
.gridview-pager td {
    text-align: center;
    padding: 10px;
    font-size: .82rem;
}

/* ----- Calendar ---------------------------------------------------- */
.calendar-control {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    background: var(--surface);
    max-width: 320px;
    margin: 0 auto;
    box-shadow: var(--shadow-xs);
}

/* ----- Tabs (Bootstrap nav-tabs) ----------------------------------- */
.nav-tabs {
    border-bottom: 2px solid var(--border);
    gap: 4px;
}

.nav-tabs .nav-link {
    border: none;
    color: var(--text-secondary);
    font-size: .86rem;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: var(--transition);
}

.nav-tabs .nav-link:hover { color: var(--ali-blue); background: var(--ali-blue-light); }

.nav-tabs .nav-link.active {
    color: var(--ali-blue);
    border-bottom: 2px solid var(--ali-blue);
    background: var(--surface);
    margin-bottom: -2px;
}

/* ----- Progress bar ------------------------------------------------ */
.progress {
    height: 8px;
    border-radius: 20px;
    background: #e2e8f0;
    overflow: hidden;
}

.progress-bar {
    background: var(--ali-blue-mid);
    border-radius: 20px;
    transition: width .4s ease;
}

/* ----- Login page -------------------------------------------------- */
.login-wrapper {
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    border-top: 4px solid var(--ali-gold);
}

.login-card h2 {
    font-size: 1.3rem;
    margin-bottom: 24px;
    text-align: center;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

/* --- Tablet landscape + small desktop (< 1200px) ------------------- */
@media (max-width: 1199px) {
    main.page-main { padding: 18px 20px 28px; }
}

/* --- Tablet portrait (< 992px) ------------------------------------- */
@media (max-width: 991px) {
    /* Navbar mobile */
    .navbar-collapse {
        background: #fff;
        padding: 8px 0 12px;
        border-top: 1px solid var(--border);
        box-shadow: 0 4px 10px rgba(0,0,0,.1);
    }
    .navbar .dropdown-menu {
        background: #fafafa;
        border: none;
        border-left: 3px solid var(--ali-red);
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }
    .navbar .dropdown-item {
        color: var(--text-secondary);
        padding: 8px 28px;
    }
    .navbar .dropdown-item i { color: var(--ali-red); opacity: .7; }
    .navbar .dropdown-item:hover { background: #fdf1f1; color: var(--ali-red); padding-left: 28px; }

    /* Page header stack */
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header .page-title { font-size: 1.1rem; }

    /* Risultati bar stack */
    .results-bar { flex-direction: column; align-items: flex-start; }

    /* Tables: scroll orizzontale obbligatorio */
    .table-scroll-wrap,
    .gridview-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-md);
    }
}

/* --- Mobile (< 768px) ---------------------------------------------- */
@media (max-width: 767px) {
    body { font-size: 13px; }

    main.page-main { padding: 12px 12px 24px; }

    header { padding: 10px 0; }
    header img { max-height: 44px; }

    /* Page header */
    .page-header { margin-bottom: 14px; padding-bottom: 12px; }
    .page-header .page-title { font-size: 1rem; gap: 7px; }
    .page-header .page-subtitle { font-size: .78rem; }

    /* Search card */
    .search-card-body { padding: 14px; }
    .search-card-title { font-size: .83rem; }

    /* Form labels + inputs più compatti */
    label { font-size: .76rem; }
    .form-control, .form-select { font-size: .84rem; padding: 6px 10px; }

    /* Bottoni */
    .btn { font-size: .8rem; padding: 7px 14px; }
    .btn-sm { font-size: .74rem; padding: 5px 10px; }

    /* Risultati bar */
    .results-bar { gap: 8px; }
    .results-count { font-size: .78rem; }

    /* Tabelle */
    .table thead th { font-size: .7rem; padding: 8px 8px; letter-spacing: 0; }
    .table td { font-size: .8rem; padding: 7px 8px; }
    .table-scroll-wrap,
    .gridview-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-md);
        /* ombra laterale come hint che si può scrollare */
        background:
            linear-gradient(to right, white 30%, rgba(255,255,255,0)),
            linear-gradient(to right, rgba(255,255,255,0), white 70%) 0 100%,
            radial-gradient(farthest-side at 0%  50%, rgba(0,0,0,.12), transparent),
            radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.12), transparent) 0 100%;
        background-repeat: no-repeat;
        background-color: white;
        background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
        background-attachment: local, local, scroll, scroll;
    }

    /* Card / container padding */
    .container-content { padding: 14px; }
    .card.p-4 { padding: 14px !important; }

    /* Login */
    .login-card { padding: 24px 16px; }
    .login-wrapper { padding: 20px 12px; }

    /* Modal full-screen su mobile */
    .modal-dialog { margin: 0; max-width: 100%; }
    .modal-content { border-radius: 0; min-height: 100vh; }
    .custom-modal-content { width: 96vw; margin: 4% auto; }
}

/* ----- Wizard steps (GestioneComunicazioni) ------------------------ */
.wizard-step-bar {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 28px;
    padding: 0;
    list-style: none;
}

.wizard-step {
    flex: 1;
    text-align: center;
    position: relative;
    padding: 0;
}

.wizard-step::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}
.wizard-step:last-child::after { display: none; }

.wizard-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.wizard-step.active .wizard-step-num {
    background: var(--ali-blue);
    color: #fff;
    box-shadow: 0 0 0 4px var(--ali-blue-light);
}

.wizard-step.done .wizard-step-num {
    background: #1a7f4b;
    color: #fff;
}

.wizard-step-label {
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: 5px;
    font-weight: 600;
    letter-spacing: .3px;
}
.wizard-step.active .wizard-step-label { color: var(--ali-blue); }

/* ----- Misc -------------------------------------------------------- */
#divInserimentoPagamento {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 20px;
    background: var(--surface);
}

/* Link inline */
a { color: var(--ali-blue-mid); text-decoration: none; }
a:hover { color: var(--ali-blue); text-decoration: underline; }
