/* Reset y variables CSS */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #06d6a0;
    --danger-color: #f72585;
    --warning-color: #f9844a;
    --info-color: #4cc9f0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --background-color: #f4f6f9;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --shadow: 0 0 20px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--dark-color);
    line-height: 1.6;
}

/* Contenedor principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Login Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--dark-color);
    font-weight: 600;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 700;
}

/* Formularios */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background-color: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control:invalid {
    border-color: var(--danger-color);
}

/* Botones */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: var(--transition);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.sidebar.collapsed .sidebar-header h3 {
    display: none;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    border-radius: 0 25px 25px 0;
    margin-right: 20px;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    transition: var(--transition);
    background-color: var(--background-color);
}

.sidebar.collapsed + .main-content {
    margin-left: 80px;
}

/* Topbar */
.topbar {
    background: white;
    padding: 15px 30px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: between;
    align-items: center;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--dark-color);
    margin-right: 20px;
}

.topbar-title {
    flex: 1;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.user-menu:hover {
    background-color: var(--light-color);
}

/* Content Area */
.content {
    padding: 30px;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    overflow: hidden;
}

.card-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e1e8ed;
    background-color: #f8f9fa;
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
}

.card-body {
    padding: 30px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    font-size: 1.5rem;
}

.stat-content h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-content p {
    margin: 5px 0 0 0;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Tablas */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th {
    background-color: var(--light-color);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid #dee2e6;
}

.table td {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    color: var(--dark-color);
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Alertas */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-success {
    background-color: #d1ecf1;
    border-color: var(--success-color);
    color: #0c5460;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: var(--warning-color);
    color: #856404;
}

.alert-info {
    background-color: #cce5ff;
    border-color: var(--info-color);
    color: #004085;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
}

.modal-dialog {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-dialog.modal-lg {
    max-width: 1200px;
    width: 95%;
}

.modal-dialog.modal-lg .modal-content {
    max-width: 100%;
    width: 100%;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Utilidades */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.flex-1 { flex: 1; }

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        transform: translateX(-100%);
        z-index: 1001;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar.collapsed + .main-content {
        margin-left: 0;
    }
    
    .topbar {
        padding: 15px 20px;
    }
    
    .content {
        padding: 20px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .table-responsive {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
    }
}

@media (max-width: 576px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .btn {
        padding: 10px 20px;
    }
    
    .topbar-title {
        font-size: 1.2rem;
    }
    
    .card-header {
        padding: 15px 20px;
    }
    
    .content {
        padding: 15px;
    }
}

/* =====================================================
   ESTILOS PARA BADGES DE TIPOS DE AGENCIAS
   ===================================================== */

/* Badges específicos para tipos de agencias */
.agencia-tipo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    white-space: nowrap;
}

/* Tipo Propia - Azul corporativo */
.agencia-tipo-propia {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #ffffff;
    border: 1px solid #0056b3;
}

.agencia-tipo-propia:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

/* Tipo Medio Punto - Amarillo/Naranja */
.agencia-tipo-medio-punto {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
    border: 1px solid #e0a800;
}

.agencia-tipo-medio-punto:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.4);
}

/* Tipo Vendedor - Verde */
.agencia-tipo-vendedor {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: #ffffff;
    border: 1px solid #1e7e34;
}

.agencia-tipo-vendedor:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

/* Iconos específicos para cada tipo */
.agencia-tipo-badge .tipo-icon {
    font-size: 1rem;
    margin-right: 2px;
}

/* Responsivo para badges */
@media (max-width: 768px) {
    .agencia-tipo-badge {
        font-size: 0.7rem;
        padding: 4px 8px;
        gap: 2px;
    }
    
    .agencia-tipo-badge .tipo-icon {
        font-size: 0.9rem;
    }
}

/* Animaciones para los badges */
@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.agencia-tipo-badge.pulse {
    animation: badgePulse 1s ease-in-out;
}

/* Estilos para tablas con badges */
.table .agencia-tipo-badge {
    margin: 2px 0;
}