/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

/* Scrollbar global delgada y elegante (en vez de la gruesa nativa) */
html {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
    border: 2px solid transparent;
    background-clip: content-box;
}

/* Nitidez en modales: evitar transform que puede causar blur subpixel */
.modal.fade .modal-dialog,
.modal.show .modal-dialog {
    transform: none !important;
}

@media (min-resolution: 2dppx) {
    .modal-content {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Sidebar moderno */
.sidebar-modern {
    background: #f8f9fa;
    color: #495057;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1045;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    border-right: 1px solid #e9ecef;
}

@media (min-width: 992px) {
    .sidebar-modern {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        height: 100vh;
    }
}



/* Header del sidebar */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 70px;
    background: #ffffff;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    padding: 8px 8px 8px 0;
    border-radius: 8px;
    margin: 0;
    cursor: pointer;
    margin-left: -8px;
}

.sidebar-brand:hover {
    background-color: #e9ecef;
    transform: scale(1.02);
}

.brand-icon {
    font-size: 24px;
    color: #000000;
    min-width: 24px;
    max-width: 40px;
    /* Fallback de seguridad */
    object-fit: contain;
}

.brand-text {
    font-size: 20px;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    color: #343a40;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* Brand text siempre visible */



/* Navegación */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.nav-section {
    padding: 15px 20px 10px;
    margin-bottom: 5px;
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #adb5bd;
    transition: opacity 0.3s ease;
}

.sidebar-modern.collapsed .section-title {
    opacity: 0;
}

.nav-item {
    margin: 2px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #6c757d;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 25px 25px 0;
    margin-right: 15px;
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    background-color: #e9ecef;
    color: #495057;
    transform: translateX(5px);
}

.nav-item.active .nav-link {
    background-color: #dee2e6;
    color: #495057;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.nav-icon {
    font-size: 16px;
    min-width: 20px;
    margin-right: 15px;
    text-align: center;
    color: #000000;
    transition: all 0.3s ease;
}

.nav-link:hover .nav-icon {
    color: #333333;
    transform: scale(1.1);
}



.nav-text {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    flex: 1;
}

.sidebar-modern.collapsed .nav-text {
    opacity: 0;
    width: 0;
}

.submenu-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.sidebar-modern.collapsed .submenu-arrow {
    opacity: 0;
}

.nav-item.has-submenu.open .submenu-arrow {
    transform: rotate(90deg);
}

/* Submenús */
.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background-color: #f8f9fa;
    border-left: 3px solid #667eea;
    margin-left: 20px;
}

.submenu .nav-item {
    margin: 0;
}

.submenu .nav-link {
    padding: 8px 20px 8px 40px;
    font-size: 13px;
    color: #6c757d;
    border: none;
    background: transparent;
}

.submenu .nav-link:hover {
    background-color: #e9ecef;
    color: #495057;
    transform: none;
}

.submenu .nav-icon {
    font-size: 12px;
    margin-right: 10px;
}

.submenu-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.nav-item.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

/* Footer del sidebar */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    margin-top: auto;
    background: #ffffff;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.user-avatar {
    font-size: 32px;
    color: #6c757d;
    min-width: 32px;
}

.user-details {
    flex: 1;
    transition: opacity 0.3s ease;
}

/* User details siempre visible */

.user-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.user-role {
    display: block;
    font-size: 12px;
    color: #868e96;
    white-space: nowrap;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background-color: #e9ecef;
    color: #6c757d;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.logout-btn:hover {
    background-color: #dee2e6;
    color: #495057;
    transform: translateY(-2px);
}

.logout-text {
    transition: opacity 0.3s ease;
}

/* Logout text siempre visible */

/* Overlay para móviles */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Ajustes para el contenido principal */
.main-content-wrapper {
    /* El layout se gestiona en modern-ui-enhancements.css para evitar doble margen */
    width: 100%;
}

/* Estilos para configuración */
.config-tabs {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: white;
    color: #007bff;
    border-bottom: 2px solid #007bff;
}

.tab-btn:hover {
    background: #e9ecef;
}

/* Estilos para pestañas personalizadas (no Bootstrap) */
.custom-tab-content {
    display: none;
    padding: 30px;
}

.custom-tab-content.active {
    display: block;
}

.config-card {
    background: white;
    border-radius: 8px;
    padding: 0;
}

.config-card h3 {
    margin: 0 0 25px 0;
    color: #333;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input[type="radio"] {
    margin: 0;
}

.logo-preview {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.preview-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 500;
}

.preview-logo i {
    font-size: 24px;
    color: #000;
}

.preview-logo img {
    max-width: 32px;
    max-height: 32px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.card-header h3 {
    margin: 0;
}

.users-table {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-admin {
    background: #dc3545;
    color: white;
}

.badge-technician {
    background: #ffc107;
    color: #212529;
}

.badge-user {
    background: #6c757d;
    color: white;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #000000;
    color: white;
}

.btn-primary:hover {
    background: #333333;
}

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

.btn-secondary:hover {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Alerta centrada en pantalla */
.alert-centered {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    min-width: 300px;
    max-width: 500px;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    animation: alertFadeIn 0.3s ease-out;
}

.alert-centered.alert-success {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    color: #495057 !important;
    border: 2px solid #6c757d !important;
}

.alert-centered .btn-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 18px;
    color: #495057;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.alert-centered .btn-close:hover {
    opacity: 1;
}

@keyframes alertFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Overlay para la alerta centrada */
.alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    animation: overlayFadeIn 0.3s ease-out;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal personalizado (no Bootstrap) */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.custom-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.custom-modal-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-modal-header h3 {
    margin: 0;
}

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #000;
}

.custom-modal form {
    padding: 20px;
}

.custom-modal-footer {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {

    .tab-buttons {
        flex-direction: column;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .custom-modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .custom-modal-footer {
        flex-direction: column;
    }
}

/* Estilos para las cards del dashboard */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.bg-dark {
    background-color: #2c3e50 !important;
}

.btn-success {
    background: #667eea;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Scrollbar personalizado */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #ced4da;
}

/* Estilos para formularios modernos */
.client-type-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e9ecef !important;
}

.client-type-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #007bff !important;
}

.client-type-card.border-primary {
    border-color: #007bff !important;
    background: #667eea !important;
}

.client-type-card.border-primary .text-primary {
    color: white !important;
}

.client-type-card.border-primary .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Mejoras en campos de formulario */
.form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

@media (max-width: 991.98px) {
    input,
    select,
    textarea,
    .form-control,
    .form-select {
        font-size: 16px !important;
    }
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

/* Estilos para secciones del formulario */
.border-start {
    border-left-width: 4px !important;
}

/* Animaciones para botones */
.btn {
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 600;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    border: none;
}

.btn-success:hover {
    background: #218838;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-outline-secondary:hover {
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.2);
}

/* Estilos para tarjetas de estadísticas mejoradas */
.stats-card {
    transition: all 0.3s ease;
    border: none;
    border-radius: 12px;
    overflow: hidden;
}

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

.stats-card .card-body {
    padding: 1.5rem;
    position: relative;
}

.stats-card .stats-icon {
    transition: all 0.3s ease;
}

.stats-card:hover .stats-icon {
    transform: scale(1.1);
}

.stats-card .stats-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin: 0.5rem 0;
}

.stats-card .stats-label {
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Efectos de gradiente para iconos */
.stats-icon-pending {
    background: #ffc107;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-icon-waiting {
    background: #fd7e14;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-icon-delivered {
    background: #007bff;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
