/**
 * VRM - Vehicle Rental Management
 * CSS Globale per Arriva Branding
 */

:root {
    --bs-primary: #00A1AC;
    --bs-primary-rgb: 0, 161, 172;
    --arriva-teal: #00A1AC;
    --arriva-dark: #006B73;
    --arriva-light: #E6F7F8;
}

/* Override Bootstrap primary color */
.bg-primary {
    background-color: var(--arriva-teal) !important;
}

.btn-primary {
    background-color: var(--arriva-teal);
    border-color: var(--arriva-teal);
}

.btn-primary:hover {
    background-color: var(--arriva-dark);
    border-color: var(--arriva-dark);
}

.text-primary {
    color: var(--arriva-teal) !important;
}

/* Logo styling */
.app-logo img {
    height: 24px;
    width: auto;
    margin-right: 8px;
}

/* Form styling */
.form-container {
    max-width: 1000px;
    margin: 0 auto;
}

/* Header e ActionBar fisse */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.action-bar {
    position: fixed;
    top: var(--navbar-height, 56px); /* Usa variabile CSS o fallback a 56px */
    left: 0;
    right: 0;
    z-index: 1020;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

/* Compensazione per elementi fissi */
body {
    padding-top: 130px; /* 56px navbar + 65px actionbar + 9px margine */
}

/* Override per mobile */
@media (max-width: 991.98px) {
    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    .action-bar {
        position: fixed;
        top: var(--navbar-height, 56px); /* Usa variabile CSS anche su mobile */
        left: 0;
        right: 0;
        z-index: 1020;
        box-shadow: 0 1px 6px rgba(0,0,0,0.1);
    }

    body {
        padding-top: 130px;
    }
}

/* Dashboard cards */
.stat-card {
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--arriva-teal);
}

/* Button actions */
.btn-action {
    margin-right: 5px;
    margin-bottom: 5px;
}

/* Table responsive */
.table th {
    background-color: var(--arriva-light);
    border-bottom: 2px solid var(--arriva-teal);
}

/* Alerts */
.alert-primary {
    background-color: var(--arriva-light);
    border-color: var(--arriva-teal);
    color: var(--arriva-dark);
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .form-container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .btn-action {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Navbar responsive */
    .navbar-title {
        font-size: 0.8rem;
        word-break: break-word;
        line-height: 1.1;
        max-width: 180px;
    }
}

@media (max-width: 480px) {
    .navbar-title {
        font-size: 0.7rem;
        max-width: 120px;
        display: block;
    }
}

/* ========================================
   PAGINA LOGIN
   ======================================== */
.login-page {
    background: linear-gradient(135deg, var(--arriva-teal) 0%, var(--arriva-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    max-width: 400px;
    width: 100%;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-header {
    text-align: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.login-body {
    padding: 2rem;
}

.login-page .app-logo {
    margin-bottom: 1rem;
}

.login-page .app-logo img {
    height: 60px;
    width: auto;
}

.login-page .form-floating {
    margin-bottom: 1rem;
}

.btn-login {
    background: linear-gradient(135deg, var(--arriva-teal) 0%, var(--arriva-dark) 100%);
    border: none;
    padding: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--arriva-dark) 0%, #005f65 100%);
    transform: translateY(-1px);
}

.system-info {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #6c757d;
}

/* ========================================
   DASHBOARD
   ======================================== */
.dashboard-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
}

.dashboard-header .logo-container {
    margin-bottom: 1rem;
}

.dashboard-header .logo-container img {
    width: 40%;
    max-width: 300px;
    height: auto;
}

.stats-card {
    border-left: 4px solid;
    transition: transform 0.2s;
}

.stats-card:hover {
    transform: translateY(-2px);
}

.stats-card.primary { border-left-color: var(--arriva-teal); }
.stats-card.success { border-left-color: #198754; }
.stats-card.info { border-left-color: #0dcaf0; }
.stats-card.warning { border-left-color: #dc3545; }

.table-responsive {
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Tab Styles */
.nav-tabs .nav-link {
    color: #6c757d;
    border: 1px solid transparent;
    border-radius: 0.375rem 0.375rem 0 0;
}

.nav-tabs .nav-link:hover {
    color: var(--bs-primary);
    border-color: #e9ecef #e9ecef #dee2e6;
}

.nav-tabs .nav-link.active {
    color: var(--bs-primary);
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
    font-weight: 600;
}

.tab-content {
    border: 1px solid #dee2e6;
    border-radius: 0 0.375rem 0.375rem 0.375rem;
    background-color: #fff;
}

.tab-pane {
    padding: 1.5rem;
}

/* Stili per ricerca automatica */
#searchInput {
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

#searchInput:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(0, 161, 172, 0.25);
}

#searchStatus {
    min-width: 50px;
    transition: all 0.2s ease-in-out;
}

.search-counter-active {
    color: var(--bs-success) !important;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    animation: spin 1s linear infinite;
}

.search-active-indicator {
    background-color: rgba(0, 161, 172, 0.1);
    border: 1px solid rgba(0, 161, 172, 0.3);
    border-radius: 0.375rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

/* ========================================
   FOOTER
   ======================================== */
.omni-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 1rem 0;
    margin-top: auto;
    font-size: 0.875rem;
    color: #6c757d;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.omni-footer .logo-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    transition: opacity 0.2s;
}

.omni-footer .logo-link:hover {
    opacity: 0.8;
    color: inherit;
}

.omni-footer .logo-link img {
    width: 96px;
    height: 24px;
    margin-right: 12px;
}

/* ========================================
   NFC E RICERCA (NEW CONCESSION)
   ======================================== */
.nfc-section {
    background: #f8f9fa;
    border: 2px dashed var(--arriva-teal);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.nfc-active {
    background: #e3f2fd;
    border-color: #2196f3;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(33, 150, 243, 0); }
    100% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0); }
}

.search-input {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-result-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

/* ========================================
   VIEW CONCESSION
   ======================================== */

/* ========================================
   CHECKIN
   ======================================== */
.level-comparison {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.level-comparison .progress {
    flex: 1;
    height: 20px;
}

.percentage-display {
    margin-top: 5px;
    font-weight: bold;
    text-align: center;
}

/* Solo le barre percentuali interattive usano colore primario */
.percentage-segment.filled,
.percentage-segment.selected {
    background-color: var(--arriva-teal) !important;
    color: white !important;
}

/* ========================================
   PHOTO COLLECTION
   ======================================== */
.photo-card {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.photo-card:hover {
    border-color: var(--arriva-teal);
    background-color: #f8f9fa;
}

.photo-card.has-photo {
    border-style: solid;
    border-color: #198754;
    background-color: #f8fff9;
}

.photo-preview {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.photo-actions {
    position: absolute;
    top: 10px;
    right: 10px;
}

.category-section {
    margin-bottom: 3rem;
}

.category-header {
    background: linear-gradient(135deg, var(--arriva-teal), #0dcaf0);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Floating Action Button */
.floating-camera-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--arriva-teal), #0dcaf0);
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 161, 172, 0.4);
    color: white;
    font-size: 24px;
    z-index: 1000;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-camera-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 161, 172, 0.6);
    color: white;
}

.floating-camera-btn:active {
    transform: scale(0.95);
}

.quick-photo-list {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 15px;
    max-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 999;
    display: none;
}

.quick-photo-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.quick-photo-item:hover {
    background-color: #f8f9fa;
}

.quick-photo-item.completed {
    background-color: #d1e7dd;
}

.quick-photo-item .icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 14px;
}

.quick-photo-item .icon.pending {
    background-color: #e9ecef;
    color: #6c757d;
}

.quick-photo-item .icon.completed {
    background-color: #198754;
    color: white;
}

.upload-area {
    border: 3px dashed var(--arriva-teal);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-color: #1976d2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,161,172,0.2);
}

.upload-area .camera-icon {
    font-size: 3rem;
    color: var(--arriva-teal);
    margin-bottom: 15px;
    display: block;
}

.upload-area:hover .camera-icon {
    color: #1976d2;
    transform: scale(1.1);
}

.camera-button {
    background: linear-gradient(135deg, var(--arriva-teal), #0dcaf0);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,161,172,0.3);
}

.camera-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,161,172,0.4);
    color: white;
}

.upload-area.dragover {
    border-color: #198754;
    background: #f8fff9;
}

.upload-area-simple {
    text-align: center;
    padding: 10px;
}

.notes-input {
    margin-top: 15px;
}

.required-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: #dc3545;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Media queries per photo collection */
@media (max-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .photo-card {
        min-height: 100px;
        padding: 12px;
    }
    
    .category-header {
        padding: 0.75rem;
        text-align: center;
    }
    
    .camera-button {
        font-size: 0.9rem;
        padding: 8px 16px;
        width: 100%;
        padding: 20px;
        font-size: 1.2rem;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
}

@media (max-width: 576px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.75rem;
    }
    
    .photo-card {
        min-height: 90px;
        padding: 10px;
    }
    
    .category-section {
        margin-bottom: 2rem;
    }
    
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Barre progress per view-concession */
.view-concession .progress {
    height: 20px;
    background-color: #e9ecef;
}

.view-concession .progress-bar-fuel {
    background-color: #ffc107;
}

.view-concession .progress-small {
    width: 100px;
    height: 20px;
}

/* ========================================
   CHECKOUT E BARRE PERCENTUALI
   ======================================== */
.readonly-info {
    background-color: #f8f9fa;
    border-left: 4px solid #28a745;
    padding: 15px;
    margin-bottom: 20px;
}

/* Barre percentuali */
.percentage-bar {
    display: flex;
    width: 100%;
    max-width: 300px;
    height: 30px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
}

.percentage-segment {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    transition: background-color 0.3s;
    font-size: 12px;
    font-weight: bold;
    color: #666;
}

.percentage-segment:last-child {
    border-right: none;
}

.percentage-segment.active {
    background-color: var(--arriva-teal);
    color: white;
}

.percentage-segment:hover {
    background-color: #e9ecef;
}

.percentage-segment.active:hover {
    background-color: var(--arriva-dark);
}

/* Livelli legacy (fuel-level, cleanliness-level) */
.fuel-level, .cleanliness-level {
    display: flex;
    gap: 10px;
    align-items: center;
}

.level-indicator {
    width: 30px;
    height: 30px;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.level-indicator.selected {
    background-color: var(--arriva-teal);
    border-color: var(--arriva-teal);
    color: white;
}

/* ===== PHOTO COLLECTION CHECKIN ===== */
.photo-upload-area {
    border: 2px dashed #0d6efd;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f0f8ff;
}

.photo-upload-area:hover {
    border-color: #0b5ed7;
    background-color: #e6f3ff;
    transform: translateY(-2px);
}

.upload-placeholder {
    color: #0d6efd;
}

/* photo-placeholder definito nella sezione VISUALIZZAZIONE FOTO */

.photo-thumbnail {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
    max-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.photo-thumbnail:hover {
    transform: scale(1.05);
}

.photo-thumbnail img {
    max-height: 200px;
    width: 100%;
    object-fit: cover;
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0.375rem;
    color: white;
    font-size: 1.5rem;
}

.photo-thumbnail:hover .photo-overlay {
    opacity: 1;
}

.photo-overlay i {
    color: white;
    font-size: 2rem;
}

.photo-column {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-item {
    width: 100%;
}

/* ===== VISUALIZZAZIONE FOTO ===== */

/* Sezione categoria foto */
.photo-category-section {
    margin-bottom: 3rem;
}

/* Riga di confronto foto */
.photo-comparison-row {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.photo-type-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 6px;
    border-left: 4px solid var(--arriva-teal);
}

/* Colonna foto */
.photo-column {
    height: 100%;
}

/* Item foto */
.photo-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: 100%;
}

/* Thumbnail foto unificate nella sezione PHOTO COLLECTION CHECKIN */

/* Note foto */
.photo-notes {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 0.5rem;
    border-left: 3px solid var(--arriva-teal);
}

.photo-info {
    text-align: center;
}

/* Placeholder foto mancante */
.photo-placeholder {
    background: white;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 3rem 1rem;
    text-align: center;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.photo-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Modal foto */
#photoModal .modal-body {
    padding: 0;
}

#photoModal img {
    border-radius: 0;
    width: 100%;
    height: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .photo-comparison-row {
        padding: 1rem;
    }
    
    .photo-type-title {
        font-size: 1.1rem;
    }
    
    .photo-thumbnail {
        max-height: 150px;
    }
    
    .photo-placeholder {
        height: 150px;
        padding: 2rem 1rem;
    }
    
    .photo-placeholder i {
        font-size: 2rem;
    }
}

/* EMAIL NOTIFICATIONS: CSS inline necessario per compatibilità email client */