/* ========================================
   VARIABILI CSS OTTIMIZZATE
   ======================================== */
:root {
    /* Colori principali */
    --primary-color: #1e88e5;
    --primary-dark: #1565c0;
    --success-color: #4caf50;
    --danger-color: #f44336;
    --warning-color: #ffc107;
    --info-color: #00bcd4;
    --secondary-color: #757575;
    
    /* Background e bordi */
    --glass-white: rgba(255, 255, 255, 0.95);
    --glass-light: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(255, 255, 255, 0.4);
    
    /* Testo */
    --text-primary: #1a1a2e;
    --text-secondary: #374151;
    
    /* Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Ombre semplificate */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* ========================================
   BASE OTTIMIZZATA
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   CARD OTTIMIZZATE
   ======================================== */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 2px solid rgba(30, 136, 229, 0.2);
    padding: 1rem 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
}

/* ========================================
   BOTONES OPTIMIZADOS
   ======================================== */
.btn {
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #388e3c);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #d32f2f);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #f57f17);
    color: #1a1a2e;
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color), #0097a7);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #616161);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ========================================
   FORMS OPTIMIZADOS
   ======================================== */
.form-control,
.form-select {
    padding: 0.75rem 1rem;
    border: 2px solid rgba(30, 136, 229, 0.3);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    width: 100%;
    font-size: 1rem;
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: block;
}

/* ========================================
   TABLE RESPONSIVE OPTIMIZADA
   ======================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.table {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-collapse: separate;
    border-spacing: 0;
}

.table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.table thead th {
    padding: 1rem;
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid var(--primary-dark);
    color: white;
}

.table tbody tr {
    border-bottom: 1px solid rgba(30, 136, 229, 0.15);
}

.table tbody td {
    padding: 1rem;
    color: var(--text-primary);
}

/* ========================================
   NAVBAR OPTIMIZADA - FONDO BLANCO
   ======================================== */
.navbar {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid rgba(30, 136, 229, 0.1);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: var(--text-primary) !important;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link.active {
    color: var(--primary-color) !important;
}

.navbar-text {
    color: var(--text-primary) !important;
    font-weight: 600;
}

/* ========================================
   ALERTS OPTIMIZADOS
   ======================================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
}

.alert-success {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
    color: #2e7d32;
}

.alert-danger {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.4);
    color: #c62828;
}

.alert-info {
    background: rgba(30, 136, 229, 0.2);
    border-color: rgba(30, 136, 229, 0.4);
    color: #1565c0;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.text-center { text-align: center; }
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--text-secondary); }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.flex-fill { flex: 1; }

/* ========================================
   MEJORAS ESPECÍFICAS PARA VISIBILIDAD
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 800;
}

p {
    color: var(--text-primary);
}

.info-item {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(30, 136, 229, 0.15);
}

.info-item-value {
    color: var(--text-primary);
}

.observations-content {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(30, 136, 229, 0.15);
    color: var(--text-primary);
}

/* ========================================
   RESPONSIVE MOBILE
   ======================================== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1rem;
    }
    
    .btn + .btn {
        margin-top: 0.5rem;
    }
    
    /* Tables mobile */
    .table-responsive {
        border-radius: 0;
        margin-left: -1rem;
        margin-right: -1rem;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid rgba(30, 136, 229, 0.2);
        border-radius: var(--radius-md);
        padding: 1rem;
        background: rgba(255, 255, 255, 0.95);
    }
    
    .table tbody td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border: none;
    }
    
    .table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        display: block;
        margin-bottom: 0.25rem;
        color: var(--primary-color);
    }
    
    /* Forms mobile */
    .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .row > [class*='col-'] {
        padding-left: 0;
        padding-right: 0;
        margin-bottom: 1rem;
    }
    
    /* Navbar mobile */
    .navbar-collapse {
        margin-top: 1rem;
        background: rgba(255, 255, 255, 0.98);
        padding: 1rem;
        border-radius: var(--radius-md);
    }
    
    .navbar-nav {
        align-items: stretch;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-radius: var(--radius-sm);
        margin-bottom: 0.25rem;
    }
    
    .navbar-text {
        display: block;
        padding: 0.75rem 1rem;
        margin-bottom: 0.5rem;
    }
    
    /* Action buttons mobile */
    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    /* Stats cards mobile */
    .stats-bar {
        flex-direction: column;
    }
    
    .stat-card {
        width: 100%;
    }
    
    /* Photo gallery mobile */
    .photo-card img {
        height: 200px;
    }
    
    /* Form actions mobile */
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* ========================================
   MEJORAS DE RENDIMIENTO
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print optimization */
@media print {
    body {
        background: white;
    }
    
    .navbar,
    .btn,
    .action-buttons {
        display: none;
    }
    
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
        background: white;
        page-break-inside: avoid;
    }
}