/*
 * assets/css/style.css
 * Stile personalizzato per il Booking System.
 * Coprende: frontend pubblico + pannello admin.
 * Base: Bootstrap 5 + Inter font.
 */

/* =============================================================================
   VARIABILI CSS GLOBALI
   ============================================================================= */
:root {
    --primary:          #4f46e5;   /* Indigo principale */
    --primary-dark:     #3730a3;
    --primary-light:    #818cf8;
    --secondary:        #64748b;
    --success:          #16a34a;
    --danger:           #dc2626;
    --warning:          #d97706;
    --info:             #0891b2;
    --bg-light:         #f8fafc;
    --bg-sidebar:       #1e1b4b;   /* Sidebar scura */
    --bg-sidebar-hover: #312e81;
    --text-dark:        #1e293b;
    --text-muted:       #64748b;
    --border-color:     #e2e8f0;
    --card-radius:      0.75rem;
    --sidebar-width:    250px;
    --topbar-height:    70px;
    --font-family:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition:       0.2s ease-in-out;
}

/* =============================================================================
   RESET E BASE
   ============================================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* =============================================================================
   FRONTEND - PAGINA PUBBLICA DI PRENOTAZIONE
   ============================================================================= */

/* Navbar */
.bg-primary-custom {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
}

.navbar-brand {
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

/* Hero */
.hero-section {
    background: linear-gradient(180deg, #eef2ff 0%, var(--bg-light) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 3rem 0 2rem;
}

.hero-icon {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.15);
}

/* Card del form di prenotazione */
.booking-card {
    border-radius: var(--card-radius);
    overflow: hidden;
}

.booking-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

/* Input groups */
.input-group-text {
    border-color: #dee2e6;
    color: var(--secondary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

/* Pulsante principale */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    transition: opacity var(--transition), transform var(--transition);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #312e81 100%);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Form text / contatori */
.form-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Footer */
.footer-custom {
    border-top: 1px solid var(--border-color);
    background: white;
}

/* =============================================================================
   ADMIN - LAYOUT GENERALE
   ============================================================================= */

.admin-page {
    background-color: #f1f5f9;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* -----------------------------------------------------------------
   SIDEBAR
   ----------------------------------------------------------------- */
.admin-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-sidebar);
    color: #c7d2fe;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    letter-spacing: -0.02em;
}

/* Blocco utente loggato in sidebar */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0,0,0,0.15);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    line-height: 1.2;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Link logout in sidebar (rosso tenue) */
.text-danger-sidebar {
    color: #fca5a5 !important;
}

.text-danger-sidebar:hover {
    color: #f87171 !important;
    background: rgba(220, 38, 38, 0.15) !important;
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 1rem 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1.25rem;
    color: #a5b4fc;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0;
    transition: background var(--transition), color var(--transition);
    position: relative;
}

.sidebar-nav li a:hover,
.sidebar-nav li.active a {
    background: var(--bg-sidebar-hover);
    color: white;
}

.sidebar-nav li.active a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-light);
    border-radius: 0 2px 2px 0;
}

.sidebar-nav li a i {
    font-size: 1rem;
    width: 1.25rem;
    flex-shrink: 0;
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    color: #1e1b4b;
    font-weight: 700;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.5rem 1.25rem;
}

/* -----------------------------------------------------------------
   CONTENUTO PRINCIPALE
   ----------------------------------------------------------------- */
.admin-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    min-height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-topbar h4 {
    font-size: 1.15rem;
    color: var(--text-dark);
}

/* =============================================================================
   STAT CARDS (dashboard)
   ============================================================================= */
.stat-card {
    background: white;
    border-radius: var(--card-radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 0.625rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-dark);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* =============================================================================
   CARDS GENERALI ADMIN
   ============================================================================= */
.card {
    border-radius: var(--card-radius);
}

.card-header {
    border-bottom: 1px solid var(--border-color);
}

/* =============================================================================
   TABELLA PRENOTAZIONI
   ============================================================================= */
.admin-table {
    font-size: 0.875rem;
}

.admin-table thead th {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.admin-table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.admin-table tbody tr:hover td {
    background-color: #f8fafc;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* Link di ordinamento colonne */
.sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sort-link:hover {
    color: var(--primary);
}

/* =============================================================================
   BADGES STATI
   ============================================================================= */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.35em 0.7em;
    border-radius: 0.4rem;
    letter-spacing: 0.02em;
}

.badge.bg-warning { color: #78350f !important; }
.badge.bg-secondary { color: white !important; }

/* =============================================================================
   PULSANTI AZIONI TABELLA
   ============================================================================= */
.btn-group .btn {
    border-radius: 0.375rem !important;
    margin-right: 2px;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* =============================================================================
   PAGINA DETTAGLIO (view-booking)
   ============================================================================= */
.detail-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 500;
}

/* =============================================================================
   PAGINA ELIMINAZIONE (delete-booking)
   ============================================================================= */
.delete-warning-icon {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.05); opacity: 0.85; }
}

/* =============================================================================
   BREADCRUMB ADMIN
   ============================================================================= */
.breadcrumb {
    font-size: 0.8rem;
    margin-bottom: 0;
}

.breadcrumb-item.active {
    color: var(--secondary);
}

/* =============================================================================
   ALERT MESSAGES
   ============================================================================= */
.alert {
    border-radius: 0.625rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

/* =============================================================================
   RESPONSIVE - nasconde sidebar su mobile
   ============================================================================= */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-content {
        margin-left: 0;
    }
}

/* =============================================================================
   SCROLLBAR PERSONALIZZATA (Webkit)
   ============================================================================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =============================================================================
   UTILITIES AGGIUNTIVE
   ============================================================================= */
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }

/* Transizioni per hover cards */
.card {
    transition: box-shadow var(--transition);
}

/* Loading state pulsante submit */
.btn.loading {
    pointer-events: none;
    opacity: 0.75;
}
