/* CRM Alfa Romeo Brescia Club - Liquid Glass Style */

@import url('https://fonts.googleapis.com/css2?family=Titillium+Web:wght@300;400;600;700&display=swap');

:root {
    --primary: #9a0005;
    --secondary: #272250;
    --gold: #ae9652;
    --green: #015514;
    --background: #ffffff;
    --text: #1a1a1a;
    --text-light: #666;
    --border: rgba(0,0,0,0.1);
    --shadow: rgba(0,0,0,0.1);
    --glass-bg: rgba(255,255,255,0.7);
    --glass-border: rgba(255,255,255,0.3);
}

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

body {
    font-family: 'Titillium Web', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    box-shadow: 0 4px 6px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

/* Desktop: fixed navbar */
@media (min-width: 769px) {
    .navbar {
        position: fixed;
        top: 0;
    }
    
    body {
        padding-top: 80px;
    }
}

.navbar-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-logo a {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
}

.navbar-logo a:hover {
    opacity: 0.8;
}

.navbar-logo img {
    height: 40px;
    width: auto;
}

.navbar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.navbar-stats {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.stat-item {
    text-align: center;
}

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

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.navbar-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Cards */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

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

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary);
}

.card-body {
    margin-top: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-family: 'Titillium Web', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

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

.btn-primary:hover {
    background: #7a0004;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(154,0,5,0.3);
}

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

.btn-secondary:hover {
    background: #1e1a3d;
    transform: translateY(-2px);
}

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

.btn-gold:hover {
    background: #8d7542;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: 'Titillium Web', sans-serif;
    font-size: 1rem;
    background: rgba(255,255,255,0.9);
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(154,0,5,0.1);
    background: white;
}

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

select.form-control {
    cursor: pointer;
}

/* Tables */
.table-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 1.5rem;
    overflow-x: auto;
}

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

.table th {
    background: rgba(154,0,5,0.1);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--secondary);
    border-bottom: 2px solid var(--border);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.table tr:hover {
    background: rgba(154,0,5,0.05);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

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

.badge-warning {
    background: #ff9800;
    color: white;
}

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

.badge-info {
    background: #2196F3;
    color: white;
}

.badge-secondary {
    background: var(--secondary);
    color: white;
}

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

/* Grid */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

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

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 8px 32px var(--shadow);
}

.stat-card-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-card-label {
    font-size: 1rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: rgba(1,85,20,0.1);
    border-color: var(--green);
    color: #004d0f;
}

.alert-error {
    background: rgba(154,0,5,0.1);
    border-color: var(--primary);
    color: #7a0004;
}

.alert-info {
    background: rgba(33,150,243,0.1);
    border-color: #2196F3;
    color: #0d47a1;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Sidebar - Desktop (default) */
.sidebar {
    position: relative;
    left: 0;
    top: 0;
    width: 250px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    padding: 2rem;
    border-right: 1px solid var(--glass-border);
    min-height: calc(100vh - 80px);
    flex-shrink: 0;
    overflow-y: auto;
}

/* Sidebar Mobile */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        height: 100vh;
        width: 250px;
        z-index: 1500;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding-top: 80px;
    }
    
    .sidebar.active {
        left: 0;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1400;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
}

.menu-toggle:hover {
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    /* Navbar Mobile */
    .navbar {
        padding: 0.75rem 1rem;
    }
    
    .navbar-content {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .navbar-logo {
        flex: 1;
        min-width: 0;
    }
    
    .navbar-title {
        display: none; /* Nascondi titolo su mobile */
    }
    
    .navbar-logo img {
        height: 32px;
    }
    
    .navbar-stats {
        display: none;
        order: 3;
        width: 100%;
        justify-content: space-around;
        padding-top: 0.5rem;
        border-top: 1px solid var(--glass-border);
    }
    
    .navbar-stats.show {
        display: flex;
    }
    
    .stat-item {
        flex: 1;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .navbar-actions {
        gap: 0.5rem;
        font-size: 0.9rem;
    }
    
    .navbar-actions span {
        display: none;
    }
    
    .menu-toggle {
        display: block;
    }
    
    /* Sidebar Mobile */
    .sidebar {
        width: 280px;
        left: -280px;
    }
    
    /* Main Content Mobile */
    main {
        padding: 1rem !important;
        width: 100% !important;
    }
    
    body {
        padding-top: 0 !important;
    }
    
    /* Container Mobile */
    .container {
        padding: 1rem;
        max-width: 100%;
    }
    
    /* Cards Mobile */
    .card {
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    /* Buttons Mobile */
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        width: auto;
        margin-bottom: 0;
    }
    
    /* Icon buttons on mobile */
    .btn-icon {
        width: auto;
        padding: 0.625rem;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 0;
    }
    
    .btn-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .btn-icon .btn-text {
        display: none;
    }
    
    /* Search form mobile */
    .search-form-mobile {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }
    
    .search-form-mobile .form-control {
        flex: 0 0 70%;
        width: 70%;
    }
    
    .search-form-mobile .btn {
        flex: 0 0 auto;
        width: auto;
        margin-bottom: 0;
    }
    
    /* Forms Mobile */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-control {
        padding: 0.625rem 0.875rem;
        font-size: 16px; /* Previene zoom su iOS */
    }
    
    /* Tables Mobile */
    .table-container {
        padding: 1rem;
        border-radius: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
        font-size: 1rem; /* Font size grande come il resto */
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
        font-size: 1rem; /* Font size grande come il resto */
    }
    
    .table th {
        font-size: 1rem; /* Font size grande come il resto */
    }
    
    /* Grid Mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Alerts Mobile */
    .alert {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    /* Modal Mobile */
    .modal-content {
        padding: 1.5rem;
        width: 95%;
        max-height: 85vh;
        border-radius: 16px;
    }
    
    /* Utilities Mobile */
    .text-right {
        text-align: left !important;
    }
    
    /* Hide elements on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* Full width on mobile */
    .full-width-mobile {
        width: 100% !important;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .navbar-stats {
        display: flex;
        width: auto;
        order: 0;
        border-top: none;
        gap: 1rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .sidebar {
        padding-top: 60px;
    }
    
    main {
        padding: 1rem !important;
    }
    
    .card {
        padding: 1.25rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .navbar-title {
        font-size: 1rem;
    }
    
    .navbar-logo img {
        height: 28px;
    }
    
    .card {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.375rem;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px; /* Apple HIG minimum touch target */
    }
    
    .form-control {
        min-height: 44px;
    }
    
    .navbar-logo a,
    .sidebar a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Remove hover effects on touch devices */
    .card:hover {
        transform: none;
    }
    
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-outline:hover {
        transform: none;
    }
}

/* Prevent text size adjustment on iOS */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Improve scrolling on mobile */
@media (max-width: 768px) {
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    .table-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Map layout mobile */
    .map-layout {
        grid-template-columns: 1fr !important;
    }
    
    .map-layout .card {
        height: 400px !important;
        min-height: 400px !important;
    }
    
    #map {
        min-height: 400px !important;
        width: 100% !important;
        display: block !important;
    }
}

/* Map container fixes */
#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.leaflet-container {
    width: 100%;
    height: 100%;
    font-family: inherit;
}

/* Desktop: show text in icon buttons */
@media (min-width: 769px) {
    .btn-icon .btn-text {
        display: inline;
        margin-left: 0.5rem;
    }
    
    .btn-icon {
        width: auto;
        padding: 0.75rem 1.5rem;
    }
    
    /* Sidebar sempre visibile su desktop */
    .sidebar {
        display: block !important;
        position: relative !important;
        left: 0 !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .menu-toggle {
        display: none !important;
    }
    
    /* Main content con margin per sidebar */
    main {
        margin-left: 0;
    }
}

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(154,0,5,0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* WYSIWYG Editor */
.ql-container {
    border-radius: 12px;
    border: 1px solid var(--border);
}

.ql-toolbar {
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.9);
}

/* Drag & Drop */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dropzone:hover {
    border-color: var(--primary);
    background: rgba(154,0,5,0.05);
}

.dropzone.dragover {
    border-color: var(--primary);
    background: rgba(154,0,5,0.1);
    border-style: solid;
    transform: scale(1.02);
}

