/* Sistema de Planta Verificadora - Estilos */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --sidebar-width: 260px;
    --header-height: 60px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-top: var(--header-height);
    background-color: #f8f9fa;
    overflow-x: hidden; /* Sin scroll horizontal */
    overflow-y: auto; /* Scroll vertical solo del body general, no de secciones */
}

html, body {
    height: auto !important;
    min-height: 100vh;
}

/* Header */
.navbar {
    height: var(--header-height);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1030;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 1020;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

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

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

.user-info {
    display: flex;
    align-items: center;
}

.avatar {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 20px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 16px;
}

.user-role {
    font-size: 12px;
    opacity: 0.8;
}

/* Navigation */
.sidebar-nav {
    padding: 0;
}

.nav-section {
    margin-bottom: 30px;
}

.nav-section-title {
    padding: 15px 20px 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.7;
    letter-spacing: 1px;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: rgba(255,255,255,0.3);
}

.nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: white;
}

.nav-link i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
}

/* Main Content */
.main-content {
    margin-left: 0;
    padding: 15px; /* Reducido de 20px a 15px */
    min-height: auto !important;
    max-height: none !important;
    height: auto !important;
    transition: margin-left 0.3s ease;
    overflow: visible !important;
}

.main-content.sidebar-open {
    margin-left: var(--sidebar-width);
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
    min-height: auto !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

.content-section.active {
    display: block !important; /* !important para sobrescribir .section-hidden */
}

/* Clase para ocultar secciones sin permisos (sin !important para que .active pueda sobrescribirla) */
.content-section.section-hidden {
    display: none;
}

/* Permitir scroll solo en tablas y listas de resultados */
.table-responsive {
    max-height: 600px;
    overflow-y: auto;
}

/* Scroll solo en contenedores de resultados específicos */
.results-container,
.audit-log-container,
.table-container {
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.stats-card {
    background: white;
    border-radius: 10px;
    padding: 15px; /* Reducido de 25px a 15px */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    height: auto; /* Cambiado de 100% a auto */
    max-height: 120px; /* Altura máxima */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.stats-card .icon {
    font-size: 1.8rem; /* Reducido de 2.5rem a 1.8rem */
    margin-bottom: 8px; /* Reducido de 15px a 8px */
}

.stats-card .number {
    font-size: 1.5rem; /* Reducido de 2rem a 1.5rem */
    font-weight: bold;
    margin: 5px 0; /* Reducido de 10px a 5px */
}
}

.stats-card .label {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Action Cards */
.action-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    text-decoration: none;
    color: inherit;
}

.action-card .icon {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.action-card h5 {
    font-weight: 600;
    margin-bottom: 10px;
}

.action-card p {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
}

/* Forms */
.form-section {
    background: white;
    border-radius: 10px;
    padding: 15px; /* Reducido de 25px a 15px */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    margin-bottom: 15px; /* Reducido de 20px a 15px */
}

.form-section h4 {
    color: #495057;
    margin-bottom: 15px; /* Reducido de 20px a 15px */
    font-weight: 600;
    font-size: 1.1rem; /* Título más pequeño */
}

/* Tables */
.table-section {
    background: white;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.table-header {
    background: #f8f9fa;
    padding: 12px 20px; /* Reducido de 20px 25px a 12px 20px */
    border-bottom: 1px solid #e9ecef;
}

.table-header h4 {
    margin: 0;
    color: #495057;
    font-weight: 600;
    font-size: 1.1rem; /* Título más pequeño */
}

.table-responsive {
    margin: 0;
}

.table {
    margin: 0;
}

.table th {
    background: #f8f9fa;
    border-top: none;
    font-weight: 600;
    color: #495057;
    padding: 15px;
}

.table td {
    padding: 15px;
    vertical-align: middle;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background: #0b5ed7;
    border-color: #0a58ca;
    transform: translateY(-1px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    /* Navbar responsivo */
    .navbar {
        padding: 0.5rem !important;
    }
    
    .navbar .d-flex {
        flex-wrap: nowrap !important;
        overflow: hidden;
    }
    
    .navbar-brand {
        font-size: 0.9rem !important;
        white-space: nowrap;
    }
    
    .navbar-brand i {
        font-size: 1rem;
    }
    
    .navbar-brand span {
        display: none; /* Ocultar texto en móvil */
    }
    
    .navbar-text {
        font-size: 0.75rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    
    .navbar-text .fw-bold {
        display: block;
        font-size: 0.8rem;
    }
    
    .navbar-text small {
        display: none !important; /* Ocultar reloj en móvil */
    }
    
    .navbar-text .badge {
        display: none !important; /* Ocultar badge 2FA en móvil */
    }
    
    .navbar-text i.fa-user {
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    .btn-sm i {
        margin-right: 0 !important;
    }
    
    .btn-sm span:not(.badge) {
        display: none; /* Ocultar texto "Salir" en móvil, solo mostrar icono */
    }
    
    /* Sidebar */
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
    }
    
    .main-content.sidebar-open {
        margin-left: 0;
    }
    
    .stats-card, .action-card {
        margin-bottom: 20px;
    }
}

/* Mobile Extra Small (menos de 576px) */
@media (max-width: 576px) {
    .navbar {
        padding: 0.25rem 0.5rem !important;
    }
    
    .navbar-text {
        max-width: 100px;
        font-size: 0.7rem !important;
    }
    
    .navbar-text .fw-bold {
        font-size: 0.75rem;
    }
    
    .btn-outline-light {
        padding: 0.25rem 0.4rem !important;
    }
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Upload Area */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #e3f2fd;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #e3f2fd;
}
/* Estilos adicionales para formularios */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 15px; /* Reducido de 20px a 15px */
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px; /* Reducido de 15px 20px a 10px 15px */
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 1rem; /* Título más pequeño */
}

.card-body {
    padding: 15px; /* Reducido de 20px a 15px */
}

/* Dashboard compacto */
#dashboard-estadisticas .card-body {
    padding: 12px; /* Reducir padding en dashboard */
}

#dashboard-estadisticas .row {
    margin-bottom: 0 !important; /* Sin margen inferior */
}

#dashboard-estadisticas .col-md-3,
#dashboard-estadisticas .col-sm-6 {
    margin-bottom: 15px; /* Reducir espacio entre columnas */
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px; /* Reducido de 8px a 5px */
    display: block;
    font-size: 0.9rem; /* Tamaño más pequeño */
}

.form-control, .form-select {
    width: 100%;
    padding: 8px 12px; /* Reducido de 10px 15px a 8px 12px */
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-outline-secondary {
    background: white;
    border: 1px solid #6c757d;
    color: #6c757d;
}

.btn-outline-secondary:hover {
    background: #6c757d;
    color: white;
}

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

.table thead th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.table tbody td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

.table-striped tbody tr:nth-child(even) {
    background: #f8f9fa;
}

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

.text-muted {
    color: #6c757d !important;
}

.text-center {
    text-align: center !important;
}

.d-grid {
    display: grid;
}

.gap-2 {
    gap: 0.5rem;
}

.d-flex {
    display: flex;
}

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

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

.mb-3 {
    margin-bottom: 0.75rem; /* Reducido de 1rem a 0.75rem */
}

.mb-4 {
    margin-bottom: 1rem; /* Reducido de 1.5rem a 1rem */
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-md-3, .col-md-4, .col-md-6, .col-md-8, .col-md-10, .col-md-12 {
    padding: 0 15px;
    width: 100%;
}

@media (min-width: 768px) {
    .col-md-3 { width: 25%; }
    .col-md-4 { width: 33.333%; }
    .col-md-6 { width: 50%; }
    .col-md-8 { width: 66.666%; }
    .col-md-10 { width: 83.333%; }
    .col-md-12 { width: 100%; }
}
