/* ========================================
   IMPORTS
   ======================================== */
@import url('https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css');
@import url('https://cdn.datatables.net/buttons/2.4.2/css/buttons.dataTables.min.css');

/* ========================================
   ROOT VARIABLES
   ======================================== */
:root {
    --primary: #4c1d95;
    --primary-light: #8b5cf6;
    --primary-dark: #2e1065;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --gray-100: #f3f4f6;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --white: #ffffff;
    --font-size-base: 13px;
    --font-size-sm: 12px;
    --font-size-lg: 14px;
    --font-size-xs: 11px;
}

/* ========================================
   RESET & BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--gray-100);
    color: var(--gray-800);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.5;
}

/* ========================================
   LAYOUT
   ======================================== */
.container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    overflow-x: hidden;
    padding: 0px;
    margin: 0px;
    
}

.content-inner{
    height: 76vh;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: 260px;
    background: var(--white);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    padding: 20px 0;
}

.logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
}

.nav-item {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-600);
    font-size: var(--font-size-base);
}

.nav-item:hover {
    background-color: var(--gray-100);
}

.nav-item.active {
    background-color: rgba(76, 29, 149, 0.1);
    border-left: 4px solid var(--primary);
    color: var(--primary);
}

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

/* Submenu items */
.nav-subitem {
    padding: 8px 20px 8px 48px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-600);
    font-size: var(--font-size-sm);
    text-decoration: none;
}

.nav-subitem:hover {
    background-color: var(--gray-100);
    color: var(--primary);
}

.nav-subitem.active {
    background-color: rgba(76, 29, 149, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.nav-subitem i {
    margin-right: 10px;
    font-size: 14px;
    width: 18px;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: var(--font-size-sm);
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    background: #f8f8f8;
    border-bottom: 1px solid #e5e7eb;
    color: #1f2937;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1f2937;
}

.card-body {
    padding: 20px;
}

/* ========================================
   FORMULARIOS
   ======================================== */
form {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-row-full {
    grid-column: span 2;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.form-label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
    font-size: var(--font-size-sm);
}

.form-label .text-danger {
    color: #dc2626;
}

.form-input,
.form-select,
.form-textarea {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: var(--font-size-base);
    transition: all 0.3s;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 60px;
}

.form-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    appearance: none;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    
}

/* ========================================
   BOTONES
   ======================================== */
.btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    height: 40px;
   
}

.btn-sm {
    padding: 4px 10px;
    font-size: var(--font-size-xs);
}

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

.btn-primary:hover {
    background: #374151;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #9ca3af;
    color: white;
}

.btn-secondary:hover {
    background: #6b7280;
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* ========================================
   DATATABLES
   ======================================== */
.dataTables_wrapper {
    padding: 15px 15px 15px 15px;
    
}

.dataTables_length {
    margin-bottom: 12px;
    font-size: var(--font-size-sm);
    color: #6b7280;
}

.dataTables_length select {
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin: 0 4px;
    background: white;
    font-size: var(--font-size-sm);
    color: #374151;
}

.dataTables_filter {
    margin-bottom: 12px;
    font-size: var(--font-size-sm);
    color: #6b7280;
}

.dataTables_filter input {
    padding: 5px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin-left: 8px;
    font-size: var(--font-size-sm);
    width: 220px;
    background: white;
}

.dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.dt-button {
    background: green !important;
    border: 1px solid #e5e7eb !important;
    padding: 5px 12px !important;
    border-radius: 4px !important;
    font-size: var(--font-size-xs) !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    color: white !important;
}

.dt-button:hover {
    background: #f3f4f6 !important;
    border-color: #d1d5db !important;
}

.dataTables_info {
    font-size: var(--font-size-sm);
    color: #6b7280;
    padding-top: 10px;
}

.dataTables_paginate {
    margin-top: 10px;
   
}

.paginate_button {
    padding: 4px 10px !important;
    margin: 0 1px !important;
    border-radius: 4px !important;
    background: white !important;
    border: 1px solid #e5e7eb !important;
    color: #4b5563 !important;
    font-size: var(--font-size-sm) !important;
}

.paginate_button.current {
    background: #f3f4f6 !important;
    border-color: #d1d5db !important;
    color: #111827 !important;
    font-weight: 500 !important;
}

.paginate_button:hover {
    background: #f9fafb !important;
    border-color: #d1d5db !important;
}

/* ========================================
   TABLAS
   ======================================== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table th {
    background: #f5f5f5;
    color: #374151;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    
}

.table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #4b5563;
    vertical-align: middle;
    font-size: 14px;
}

.table tr:hover {
    background: #fafafa;
}

/* Filtros por columna */
#filterRow th {
    background: #fafafa;
    padding: 6px 12px;
    border-bottom: 1px solid #e5e7eb;
}

#filterRow th input,
#filterRow th select {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: var(--font-size-sm);
    background: white;
}

#filterRow th input:focus,
#filterRow th select:focus {
    outline: none;
    border-color: #9ca3af;
}

/* ========================================
   BADGES
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-danger {
    background: #ffebee;
    color: #c62828;
}

.badge-warning {
    background: #fff8e1;
    color: #f57c00;
}

.badge-info {
    background: #e3f2fd;
    color: #1565c0;
}

/* ========================================
   ALERTAS
   ======================================== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.3s ease-out;
    font-size: var(--font-size-sm);
}

.alert-success {
    background: #d1fae5;
    border: 1px solid var(--success);
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    border: 1px solid var(--danger);
    color: #991b1b;
}

.alert-warning {
    background: #fed7aa;
    border: 1px solid var(--warning);
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border: 1px solid var(--info);
    color: #1e40af;
}

/* ========================================
   MODAL
   ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: #FAFAFA;
    color: black;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 22px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    font-size: var(--font-size-sm);
}

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

/* ========================================
   TEXTOS
   ======================================== */
.text-danger {
    color: #dc2626;
    font-size: var(--font-size-xs);
    margin-top: 4px;
}

.text-success {
    color: var(--success);
    font-size: var(--font-size-xs);
    margin-top: 4px;
}

.text-muted {
    color: #6b7280;
    font-size: var(--font-size-xs);
}

/* ========================================
   ANIMACIONES
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .nav-item {
        padding: 8px 16px;
        font-size: var(--font-size-sm);
    }

    .nav-item i {
        font-size: 14px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .card-header {
        flex-direction: column;
        text-align: center;
    }

    .card-body {
        padding: 15px;
    }

    .table th,
    .table td {
        padding: 6px 8px;
        font-size: var(--font-size-xs);
    }
}