/* GTS Rail - Custom Styles */

/* Stili per autocomplete merci NHM */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1050;
}

.autocomplete-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.15s ease-in-out;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #e9ecef;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

:root {
    --primary-color: #ff6b35;        /* GTS Orange - Colore principale */
    --secondary-color: #1e3a8a;      /* GTS Navy Blue - Colore secondario */
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #1e3a8a;           /* GTS Navy Blue per testi scuri */

    /* Variabili brand usate nel login e nel pulsante manuale utente */
    --brand: #ff7a18;
    --brand2: #ffb347;
}

/* Train Map Markers */
.train-marker {
    background: linear-gradient(135deg, #ff6b35 0%, #e55a2b 100%);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.train-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(255, 107, 53, 0.4);
}

.station-marker {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: white;
    transition: all 0.3s ease;
}

.station-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(30, 58, 138, 0.4);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

.sidebar {
    background: #292929 !important;
    min-height: 100vh;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 0.25rem 0;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateX(5px);
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 0.5rem;
}

.main-content {
    background-color: #f8f9fa;
    min-height: 100vh;
}

.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), #e55a2b);
    color: white;
    border-radius: 0.75rem 0.75rem 0 0 !important;
    border: none;
}

.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

.table {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border: none;
    font-weight: 600;
    color: var(--dark-color);
}

.badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
}

/* Migliora contrasto delle tab in modale con header scuro */
.modal .nav-tabs .nav-link {
    color: #495057 !important;
    background-color: #fff !important;
    border-color: #dee2e6 !important;
}

.modal .nav-tabs .nav-link:hover {
    color: #212529 !important;
    background-color: #f8f9fa !important;
}

.modal .nav-tabs .nav-link.active {
    color: #212529 !important;
    background-color: #fff !important;
    border-color: #dee2e6 #dee2e6 #fff !important;
    font-weight: 600 !important;
}

.modal .nav-tabs .nav-link.active:hover {
    color: #212529 !important;
    background-color: #f8f9fa !important;
}

.modal .btn-secondary {
    color: #fff !important;
}

.stats-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-left: 4px solid var(--primary-color);
}

.stats-card .card-body {
    padding: 1.5rem;
}

.stats-card h4 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .stats-card h4 {
        font-size: 1.5rem;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* GTS Rail Header */
.gts-header {
    background: linear-gradient(135deg, #ff6b35 0%, #e55a2b 100%) !important;
}

/* GTS Rail Card Headers */
.gts-card-header {
    background: #292929 !important;
    color: white !important;
}

/* GTS Rail Sidebar - Forza override */
.sidebar,
div.sidebar,
.sidebar.position-fixed {
    background: #292929 !important;
    background-color: #292929 !important;
}

/* GTS Rail Buttons - Arancione */
.btn-primary,
.btn-primary:focus,
.btn-primary:active {
    background-color: #ff6b35 !important;
    border-color: #ff6b35 !important;
    color: white !important;
}

.btn-primary:hover {
    background-color: #e55a2b !important;
    border-color: #e55a2b !important;
    color: white !important;
}

.btn-outline-primary {
    color: #ff6b35 !important;
    border-color: #ff6b35 !important;
}

.btn-outline-primary:hover {
    background-color: #ff6b35 !important;
    border-color: #ff6b35 !important;
    color: white !important;
}

/* Bottone "Accedi" / Manuale Utente - stile condiviso */
.btn-login {
    /* Colori identici alla pagina di login: --brand #ff7a18, --brand2 #ffb347 */
    background: linear-gradient(135deg, #ff7a18, #ffb347);
    border: none;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: .2px;
    color: #fff;
}

.btn-login:hover {
    filter: brightness(1.05);
    color: #fff;
}

/* Rimuovi effetti hover aggiuntivi solo per il pulsante manuale utente nella sidebar */
.btn-user-manual:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* GTS Rail Utility Classes */
.gts-min-height-300 {
    min-height: 300px;
}

.gts-border-radius-1rem {
    border-radius: 1rem;
}

.gts-overflow-hidden {
    overflow: hidden;
}

.gts-bg-white-20 {
    background: rgba(255, 255, 255, 0.2);
}

.gts-table-header {
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%);
}

.gts-border-radius-0 {
    border-radius: 0;
}

.gts-font-size-09 {
    font-size: 0.9rem;
}

/* Composizione Carri Styles */
.carro-row {
    transition: all 0.2s ease;
}

.carro-row:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.carro-row.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
}

.table td {
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
}

.badge {
    font-weight: 500;
}

.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.casse-info {
    min-height: 40px;
    display: flex;
    align-items: center;
}

/* Mobile Card Styles */
.carro-card {
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.carro-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-color: #ff6b35;
}

.carro-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.carro-card .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
}

.carro-card .card-body {
        padding: 1rem;
    }
    
.carro-card .btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Mobile responsive adjustments */
@media (max-width: 576px) {
    .carro-card .btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    .carro-card .card-body {
        padding: 0.75rem;
    }
    
    .carro-card .card-header {
        padding: 0.5rem 0.75rem;
    }
}

/* Logout page styles */
.logout-card {
    border-radius: 15px;
}

/* Template Import Styles */
.template-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #ff6b35;
}

.template-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 107, 53, 0.1);
    border-radius: 50%;
}

.template-content {
    flex: 1;
}

.template-title {
    color: #1f2937;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.template-description {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.import-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.step-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #ff6b35 0%, #e55a2b 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content strong {
    color: #1f2937;
    display: block;
    margin-bottom: 0.25rem;
}

.step-content p {
    color: #6b7280;
    font-size: 0.9rem;
    margin: 0;
}

.import-actions {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
}

.format-info {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.85rem;
}

/* Responsive per template */
@media (max-width: 768px) {
    .template-card {
        flex-direction: column;
        text-align: center;
    }
    
    .template-icon {
        align-self: center;
    }
    
    .import-steps {
        gap: 0.75rem;
    }
    
    .step {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .step-number {
        align-self: center;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.email-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.email-chip {
    background-color: #f4f6f8;
    border: 1px solid #d8dde3;
    border-radius: 999px;
    padding: 0.15rem 0.75rem;
    font-size: 0.85rem;
    color: #1f2d3d;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.email-chip i {
    color: #007bff;
}

.email-chip-remove {
    border: none;
    background: transparent;
    color: #6c757d;
    padding: 0;
    margin-left: 0.25rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.email-chip-remove:hover {
    color: #dc3545;
}

.email-chip-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.email-chip-input:focus-within {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.email-chip-input.is-invalid {
    border-color: #dc3545;
    padding-right: calc(0.75rem + 1.5rem);
    background-image: var(--bs-form-invalid-icon);
    background-repeat: no-repeat;
    background-position: right calc(0.375rem + 0.375rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.email-chip-input-field {
    border: none;
    outline: none;
    flex: 1;
    min-width: 120px;
    font-size: 1rem;
    background: transparent;
}

.email-chip-input-field::placeholder {
    color: #adb5bd;
}

.avviso-item .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
}

.star-rating-input {
    display: flex;
    gap: 0.35rem;
}

.star-rating-button {
    border: none;
    background: transparent;
    font-size: 1.35rem;
    color: #cbd5f5;
    cursor: pointer;
    transition: color 0.15s ease-in-out;
}

.star-rating-button.active {
    color: #ffc107;
}

.star-rating-button:focus {
    outline: none;
}

.feedback-history-item {
    background-color: #f8f9fa;
}

/* Admin avvisi layout */
.admin-avviso-card {
    background-color: #fff;
}

.admin-avviso-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 100%;
}

.admin-avviso-select label {
    margin-bottom: 0.25rem;
}

.avviso-text-box {
    padding: 0.75rem;
    width: 100%;
    background-color: #f8f9fa;
    min-height: 110px;
    max-height: 320px;
    overflow-y: auto;
}

@media (max-width: 767.98px) {
    .avviso-text-box {
        max-height: none;
    }
}

.status-dropdown {
    min-width: 1px;
    margin-left: auto;
    align-self: flex-start;
    position: relative;
    z-index: 2000;
}

.status-pill-btn {
    border: none;
    background-color: var(--status-color, #6c757d);
    color: #fff;
    padding: 0.35rem 0.85rem;
    border-radius: 0.75rem;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1051;
}

.status-pill-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.status-pill-label {
    color: #fff;
}

.status-arrow {
    color: #fff;
    font-size: 0.8rem;
}

.status-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    background: #fff;
    z-index: 2001;
    min-width: 200px;
    border: 1px solid #dee2e6;
    padding: 0.25rem 0;
}

.status-dropdown-item {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.9rem;
    transition: background-color 0.15s ease-in-out;
}

.status-dropdown-item:hover,
.status-dropdown-item.active {
    background-color: #f1f3f5;
}