:root {
    --colore1: #000032;
    --colore2: #0b1e4b;
    --primary-color: #06A660;
    --accent-color: #0a9396;
    --primary-dark: #0096C7;
    --primary-light: #48CAE4;
    --secondary-color: #90E0EF;
    --text-dark: #023E8A;
    --success-color: #06FFA5;
    --warning-color: #FFB700;
    --danger-color: #FF006E;

    --z-index-nav: 1000;
    --z-index-overlay: 4000;
    --z-index-modal-backdrop: 5000;
    --z-index-modal: 5010;
    --z-index-dropdown-campo: 6000;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--colore1) !important;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.navbar {
    background-color: var(--colore2) !important;
    box-shadow: 0 2px 10px rgba(0, 180, 216, 0.3);
}

.navbar-brand {
    font-weight: bold;
    color: white !important;
    font-size: 1.3rem;
}
.navbar .brand-logo {
    display: inline-block;
    object-fit: contain;
    /* se il logo ha sfondo bianco, arrotondalo un filo */
    border-radius: 6px;
    /* se il logo è scuro e la navbar è scura, puoi schiarirlo leggermente */
    /* filter: brightness(1.1) contrast(1.05); */
  }
.container-fluid {
    padding: 0;
}

.main-content {
    background: var(--colore1) !important;
    min-height: calc(100vh - 56px);
    padding: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    border: none;
    border-radius: 25px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 180, 216, 0.4);
}

.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.card-header {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 600;
    border: none;
}

.form-control, .form-select {
    border: 2px solid var(--accent-color);
    border-radius: 10px;
    padding: 0.7rem;
    font-size: 16px; /* Previene zoom su iOS */
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 180, 216, 0.25);
}

.alert {
    border-radius: 10px;
    border: none;
}

.budget-indicator {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    color: white;
    text-align: center;
}

.budget-ok { background: linear-gradient(90deg, #06FFA5 0%, #00D084 100%); }
.budget-warning { background: linear-gradient(90deg, #FFB700 0%, #FF8C00 100%); }
.budget-danger { background: linear-gradient(90deg, #FF006E 0%, #C9184A 100%); }

.floating-budget {
  display: block;              /* << visibile di default */
  position: fixed;
  bottom: 70px;
  right: 20px;
  background: white;
  padding: 1rem;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,.15);
  z-index: 1000;
  min-width: 150px;
}

/* Nascondi il budget quando c'è un modal aperto */
body.modal-open .floating-budget {
  display: none !important;
}

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  box-shadow: 0 -2px 10px rgba(0,0,0,.1);
  z-index: 1000;
  display: flex;                 /* <- cambia da none a flex */
  justify-content: space-around;
  padding: 0.5rem;
}
.ballottaggi-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0;
    height: 60px;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    margin: 0 !important;  /* Rimuove eventuali margini */
    max-width: none !important;  /* Override eventuali max-width */
    transform: none !important;  /
}

.ballottaggi-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    text-decoration: none;
    color: #6c757d;
    transition: all 0.2s;
    position: relative;
    height: 100%;
    text-align: center;
}

.ballottaggi-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 2px;
    transition: transform 0.2s;
    display: block;
}

.ballottaggi-nav-item .nav-label {
    font-size: 0.85rem;
    font-weight: 600;
    display: block;  /* Aggiunto per garantire che sia block level */
    width: 100%;  /* Occupa tutta la larghezza disponibile */
    line-height: 1.2;  /* Migliora l'allineamento verticale del testo */
}

.ballottaggi-nav-item.active {
    color: #9b59b6;
}

.ballottaggi-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.ballottaggi-nav-item:active {
    transform: scale(0.95);
}

.ballottaggi-nav-item.active i {
    transform: translateY(-2px);
}

/* Aggiungi padding al contenuto quando la nav è visibile */
body.has-ballottaggi-nav .main-content {
    padding-bottom: 80px;
}

/* Nascondi la nav tabs normale quando usi la bottom nav */
body.has-ballottaggi-nav .ballottaggi-tabs {
    display: none;
}


@media (max-width: 768px) {
    .ballottaggi-nav {
        width: 100vw !important;
        left: 0 !important;
        transform: none !important;
        max-width: none !important;
        border-radius: 0;
    }
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        padding: 0.5rem;
    }
    
    .main-content {
        padding-left: 5px;
        padding-right: 5px;
        padding-bottom: 80px;

    }
    
    .floating-budget {
        bottom: 80px;
        right: 10px;
        padding: 0rem 0rem 1rem 0rem;
        border-radius: 10px;
        min-width: 80px;
    }
}

.bottom-nav-item {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.8rem;
}

.bottom-nav-item i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.2rem;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2rem;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--accent-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.gara-topbar{
  position: sticky; top: 0; z-index: 100;
  display:flex; align-items:center; gap:.5rem;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  background: var(--primary-color); color:#fff;
}
.icon-btn{ min-width:44px; min-height:44px; display:grid; place-items:center; background-color: var(--colore1); color:var(--primary-color) }
.gara-topbar__title{ font-weight:600; font-size:1.05rem; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.link-small{ color:#fff; opacity:.9; text-decoration:none; padding:6px 8px }

.gara-cta{
  position: sticky; bottom: calc(8px + env(safe-area-inset-bottom));
  padding: 8px 12px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.95));
}
.btn-primary, .btn-outline{ min-height:48px; border-radius:12px; font-weight:600 }
.btn-outline{ border:1px solid #ced4da; background:#fff }

.chip-state{ margin-left:.25rem; padding:.15rem .5rem; border-radius:999px; font-size:.75rem; background:#fff2 }
.chip-pending{ background:#ffc10722 } .chip-running{ background:#0d6efd22 } .chip-done{ background:#28a74522 }

.main-content{ padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
