/* Parcheggio Aeroportuale v2 - Main Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f3f4f6;
    --dark: #1f2937;
    --text: #374151;
    --border: #e5e7eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--light);
}

/* ===== Sidebar Layout ===== */
body.with-sidebar {
    padding-left: 260px; /* spazio per la sidebar su desktop */
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: #0b1220; /* dark blu-nero stile Velzon */
    color: #c7d2fe;
    box-shadow: 2px 0 12px rgba(0,0,0,0.2);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform .25s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    text-decoration: none;
    color: #eef2ff;
}
.brand i { color: #60a5fa; }

.sidebar-close {
    display: none;
    background: transparent;
    border: 0;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
}

.sidebar-menu {
    padding: 12px 8px;
    overflow-y: auto;
    flex: 1;
}
.sidebar-section { margin-top: 14px; }
.sidebar-section-title {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
    padding: 8px 12px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 4px 4px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    transition: background .2s, color .2s;
}
.sidebar-item i { width: 18px; color: #93c5fd; }
.sidebar-item:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.sidebar-item.active { background: rgba(59,130,246,0.18); color: #e5edff; }

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 10px 8px;
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    color: #e2e8f0; text-decoration: none;
    padding: 8px 10px; border-radius: 8px;
}
.sidebar-user:hover { background: rgba(255,255,255,0.06); }
.sidebar-logout { width: 100%; margin-top: 8px; padding: 10px; border: 1px solid rgba(239,68,68,.4); background: rgba(239,68,68,.15); color: #fecaca; border-radius: 8px; cursor: pointer; }
.sidebar-logout:hover { background: rgba(239,68,68,.25); }

.sidebar-toggle {
    position: fixed; top: 14px; left: 14px; z-index: 1200;
    width: 40px; height: 40px; border-radius: 10px;
    display: none; align-items: center; justify-content: center;
    background: #0b1220; color: #cbd5e1; border: 1px solid rgba(255,255,255,0.08);
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile / Tablet */
@media (max-width: 1024px) {
    body.with-sidebar { padding-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-sidebar.open ~ .sidebar-toggle {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
    .sidebar-close { display: inline-flex; }
}

/* Header/Navbar */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    white-space: nowrap;
    flex-shrink: 0;
}

.navbar-brand i {
    font-size: 1.4rem;
}

.navbar-menu {
    display: flex;
    gap: 8px;
    list-style: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.navbar-menu::-webkit-scrollbar {
    display: none;
}

.navbar-menu a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.navbar-menu a:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-2px);
}

.navbar-menu a.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.navbar-user a:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Bottom Menu iOS Style (Mobile) */
.bottom-menu {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
    padding: 8px 0 max(20px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    overflow: hidden;
}

.menu-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0 env(safe-area-inset-right, 10px) 0 env(safe-area-inset-left, 10px);
    box-sizing: border-box;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #8e8e93;
    transition: all 0.2s;
    cursor: pointer;
    flex: 1;
    padding: 5px;
}

.menu-item.active {
    color: #667eea;
}

.menu-item:active {
    transform: scale(0.9);
}

.menu-icon {
    font-size: 24px;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.menu-item.active .menu-icon {
    color: #667eea;
}

.menu-label {
    font-size: 10px;
    font-weight: 500;
    margin-top: 2px;
}

.user-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
}

.user-badge.admin {
    background: rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.5);
}

.user-badge.employer {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.2);
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    padding: 24px;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--dark);
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0;
}

.card-content {
    padding: 20px;
}

.card-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--light);
    font-weight: 600;
    font-size: 14px;
}

.table tbody tr:hover {
    background: #f9fafb;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-coperto {
    background: #dbeafe;
    color: #1e40af;
}

.badge-scoperto {
    background: #fef3c7;
    color: #92400e;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal {
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
    color: #999;
    cursor: pointer;
    border: none;
    background: none;
}

.close-modal:hover {
    color: #333;
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-width: 400px;
}

.notification.success {
    background: var(--success);
}

.notification.error {
    background: var(--danger);
}

.notification.info {
    background: var(--info);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
}

/* Search */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 40px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
    body {
        padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
        overflow-x: hidden;
    }
    
    .navbar {
        display: none !important;
    }
    
    .bottom-menu {
        display: block !important;
    }
    
    .container {
        max-width: 100vw;
        overflow-x: hidden;
        padding: 12px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 12px;
    }
    
    .card-content {
        padding: 12px;
    }
    
    .card-header h2 {
        font-size: 1.1rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: 8px 14px;
    }
    
    .modal-content {
        width: 95%;
        max-width: 95vw;
        padding: 16px;
    }
    
    /* Tabella responsive */
    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    
    .table thead {
        display: table-header-group;
    }
    
    .table tbody {
        display: table-row-group;
    }
    
    .table th,
    .table td {
        padding: 8px;
        font-size: 0.8rem;
    }
    
    .table .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    .table .btn-sm i {
        font-size: 0.85rem;
    }
}
