/* ===================================================
   SGI PORTAL - ESTILOS UNIFICADOS DE COMPONENTES
   Complementa themes.css con estilos específicos
   =================================================== */

/* ===== TABLAS UNIFICADAS ===== */
.table-standard {
    border-radius: 0.375rem;
    overflow: hidden;
}

.table-standard thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid;
    vertical-align: middle;
    padding: 0.875rem 0.75rem;
}

.table-standard tbody td {
    vertical-align: middle;
    padding: 0.75rem;
}

.table-standard tbody tr {
    transition: background-color 0.2s ease;
}

.table-standard tbody tr:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Tabla responsive mejorada */
.table-responsive {
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

/* ===== CARDS UNIFICADOS ===== */
.card-standard {
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0,0,0,0.075);
    transition: all 0.3s ease;
}

.card-standard:hover {
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.card-standard .card-header {
    border-radius: 0.5rem 0.5rem 0 0;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-standard .card-body {
    padding: 1.25rem;
}

/* ===== FILTROS UNIFICADOS ===== */
.filter-panel .card-header {
    background-color: var(--bs-secondary-bg);
    cursor: pointer;
    user-select: none;
}

.filter-panel .card-header:hover {
    background-color: var(--bs-border-color);
}

.filter-panel .form-floating {
    margin-bottom: 0.75rem;
}

.filter-panel .btn-group {
    width: 100%;
}

/* ===== BOTONES DE ACCIÓN ===== */
.action-buttons .btn {
    min-width: 2.5rem;
}

.action-buttons .btn i {
    font-size: 0.875rem;
}

.btn-group .btn + .btn {
    margin-left: -1px;
}

/* ===== FORMULARIOS UNIFICADOS ===== */
.form-floating label {
    font-weight: 500;
    opacity: 0.7;
}

.form-floating input:focus ~ label,
.form-floating select:focus ~ label,
.form-floating textarea:focus ~ label {
    opacity: 1;
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.15);
}

.form-floating > .form-control:focus,
.form-floating > .form-select:focus {
    border-width: 2px;
}

/* Validación mejorada */
.was-validated .form-control:invalid,
.form-control.is-invalid {
    border-color: #dc3545;
    background-image: none;
    padding-right: calc(1.5em + 0.75rem);
}

.was-validated .form-control:valid,
.form-control.is-valid {
    border-color: #198754;
    background-image: none;
    padding-right: calc(1.5em + 0.75rem);
}

.invalid-feedback,
.valid-feedback {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ===== BADGES UNIFICADOS ===== */
.badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 0.25rem;
}

.badge-lg {
    font-size: 1rem;
    padding: 0.5em 0.85em;
}

.badge-sm {
    font-size: 0.75rem;
    padding: 0.25em 0.5em;
}

/* ===== ALERTAS UNIFICADAS ===== */
.alert {
    border-radius: 0.5rem;
    border-left-width: 4px;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

.alert i {
    font-size: 1.25rem;
    vertical-align: middle;
}

.alert-success {
    border-left-color: #198754;
}

.alert-danger {
    border-left-color: #dc3545;
}

.alert-warning {
    border-left-color: #ffc107;
}

.alert-info {
    border-left-color: #0dcaf0;
}

/* ===== PAGINACIÓN UNIFICADA ===== */
.pagination {
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    border-radius: 0.375rem;
    overflow: hidden;
}

.page-item .page-link {
    border: none;
    padding: 0.5rem 0.75rem;
    color: inherit;
    transition: all 0.2s ease;
}

.page-item.active .page-link {
    font-weight: 600;
}

.page-item:not(.disabled) .page-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ===== BÚSQUEDA EN TABLAS ===== */
.table-search {
    position: relative;
}

.table-search input {
    padding-left: 2.5rem;
}

.table-search i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--bs-secondary);
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* ===== LOADING SPINNER ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    text-align: center;
}

/* ===== BREADCRUMBS ===== */
.breadcrumb {
    background-color: transparent;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.25rem;
}

/* ===== STATS CARDS (Dashboard) ===== */
.stats-card {
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
}

.stats-card .stats-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.stats-card .stats-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stats-card .stats-label {
    font-size: 0.875rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Admin stats */
body.area-admin .stats-card {
    border-left-color: var(--admin-primary);
}

body.area-admin .stats-card .stats-icon {
    background-color: var(--admin-sidebar-bg);
    color: var(--admin-primary);
}

/* Cliente stats */
body.area-cliente .stats-card {
    border-left-color: var(--cliente-primary);
}

body.area-cliente .stats-card .stats-icon {
    background-color: var(--cliente-sidebar-bg);
    color: var(--cliente-primary);
}

/* ===== TABS PERSONALIZADOS ===== */
.nav-tabs .nav-link {
    border-radius: 0.5rem 0.5rem 0 0;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    font-weight: 600;
}

body.area-admin .nav-tabs .nav-link.active {
    color: var(--admin-primary);
    border-bottom-color: var(--admin-primary);
}

body.area-cliente .nav-tabs .nav-link.active {
    color: var(--cliente-primary);
    border-bottom-color: var(--cliente-primary);
}

/* ===== RESPONSIVE UTILITIES ===== */
@media (max-width: 768px) {
    .table-standard {
        font-size: 0.875rem;
    }

    .table-standard thead th,
    .table-standard tbody td {
        padding: 0.5rem;
    }

    .btn-group-vertical .btn {
        width: 100%;
    }

    .stats-card .stats-value {
        font-size: 1.5rem;
    }

    .filter-panel .d-flex {
        flex-direction: column;
    }

    .filter-panel .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.3s ease;
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .footer,
    .btn,
    .filter-panel,
    .action-buttons {
        display: none !important;
    }

    .card {
        border: 1px solid #dee2e6;
        box-shadow: none;
    }

    .table {
        font-size: 10pt;
    }
}
