/**
 * Gestionale AVIS - Stili Custom
 * Design professionale, pulito e moderno
 */

:root {
    --avis-red: #E31837;
    --avis-red-dark: #b8132c;
    --avis-red-light: #ff4d6a;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;
    --footer-height: 50px;
}

/* ============================================
   Base Styles
   ============================================ */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9rem;
    background-color: #f4f6f9;
    color: #333;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--avis-red);
}

a:hover {
    color: var(--avis-red-dark);
}

/* ============================================
   Layout Wrapper
   ============================================ */

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

#content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    z-index: 1000;
    transition: width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
}

.sidebar-brand:hover {
    color: #fff;
}

.sidebar-brand i {
    font-size: 1.8rem;
}

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

.nav-header {
    padding: 0.75rem 1.25rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.nav-item {
    margin: 0.15rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-link.active {
    background: var(--avis-red);
    color: #fff;
    font-weight: 500;
}

/* ============================================
   Topbar
   ============================================ */

.topbar {
    height: var(--topbar-height);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    padding: 1.5rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    height: var(--footer-height);
    padding: 1rem 1.5rem;
    background: #fff;
    border-top: 1px solid #e9ecef;
    font-size: 0.8rem;
}

/* ============================================
   Cards
   ============================================ */

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
    border-left: 4px solid var(--avis-red);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card.primary { border-left-color: var(--avis-red); }
.stat-card.success { border-left-color: #28a745; }
.stat-card.info { border-left-color: #17a2b8; }
.stat-card.warning { border-left-color: #ffc107; }

/* ============================================
   Tables
   ============================================ */

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

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

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-actions {
    white-space: nowrap;
}

.table-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* ============================================
   Forms
   ============================================ */

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 0.4rem;
}

.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.6rem 0.875rem;
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--avis-red);
    box-shadow: 0 0 0 3px rgba(227, 24, 55, 0.15);
}

.input-group-text {
    border-radius: 8px;
    background: #f8f9fa;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--avis-red);
    border-color: var(--avis-red);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--avis-red-dark);
    border-color: var(--avis-red-dark);
}

.btn-outline-primary {
    color: var(--avis-red);
    border-color: var(--avis-red);
}

.btn-outline-primary:hover {
    background: var(--avis-red);
    border-color: var(--avis-red);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Badges
   ============================================ */

.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    border: none;
    border-radius: 10px;
    border-left: 4px solid;
}

.alert-success { border-left-color: #28a745; background: #d4edda; }
.alert-danger { border-left-color: #dc3545; background: #f8d7da; }
.alert-warning { border-left-color: #ffc107; background: #fff3cd; }
.alert-info { border-left-color: #17a2b8; background: #d1ecf1; }

/* ============================================
   Modal
   ============================================ */

.modal-content {
    border: none;
    border-radius: 12px;
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
}

/* ============================================
   Search & Filters
   ============================================ */

.search-box {
    position: relative;
}

.search-box .form-control {
    padding-left: 2.5rem;
}

.search-box .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
}

.filter-bar {
    background: #fff;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ============================================
   Login Page
   ============================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, var(--avis-red) 100%);
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 3.5rem;
    color: var(--avis-red);
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-top: 0.5rem;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state h5 {
    color: #495057;
}

/* ============================================
   Member Card (Tessera)
   ============================================ */

.member-card {
    background: linear-gradient(135deg, var(--avis-red) 0%, var(--avis-red-dark) 100%);
    color: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(227, 24, 55, 0.3);
}

.member-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1.5rem;
}

.member-card-logo {
    font-size: 2rem;
}

.member-card-number {
    font-size: 0.75rem;
    opacity: 0.8;
}

.member-card-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.member-card-blood {
    font-size: 2rem;
    font-weight: 700;
    position: absolute;
    right: 1.5rem;
    bottom: 1.5rem;
    opacity: 0.9;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    #content {
        margin-left: 0;
    }

    .topbar {
        padding: 0 1rem;
    }

    .main-content {
        padding: 1rem;
    }
}

@media (max-width: 575.98px) {
    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .table-responsive {
        font-size: 0.85rem;
    }
}

/* ============================================
   Utilities
   ============================================ */

.text-avis {
    color: var(--avis-red) !important;
}

.bg-avis {
    background-color: var(--avis-red) !important;
}

.border-avis {
    border-color: var(--avis-red) !important;
}

.cursor-pointer {
    cursor: pointer;
}

.min-h-300 {
    min-height: 300px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}
