/* DETAIL DRAWER (Side Panel) */
.detail-drawer {
    position: fixed;
    right: -500px;
    top: 0;
    width: 480px;
    height: 100vh;
    background: #1a202c;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    color: white;
    border-left: 1px solid #2d3748;
}

.detail-drawer.active {
    right: 0;
}

.detail-drawer-header {
    padding: 20px;
    background: #2d3748;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #4a5568;
}

.detail-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.detail-item {
    margin-bottom: 10px;
}

.detail-label {
    font-size: 0.75rem;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 2px;
}

.detail-value {
    font-size: 0.95rem;
    font-weight: 600;
}

.detail-section-title {
    grid-column: span 2;
    font-size: 0.85rem;
    font-weight: 800;
    color: #63b3ed;
    margin: 15px 0 5px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #2d3748;
}

.detail-drawer-footer {
    padding: 20px;
    background: #2d3748;
    border-top: 1px solid #4a5568;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 1 !important;
    visibility: visible !important;
}

/* Base Table Styles */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 12px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    font-weight: 700;
}

td {
    padding: 14px 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Zebra Striping */
tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

.clickable-row {
    cursor: pointer;
    transition: background 0.2s;
}

.clickable-row:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Status Badges (Pills) */
.badge-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    letter-spacing: 0.5px;
}

.badge-activa,
.badge-validada {
    background: rgba(72, 187, 120, 0.15);
    color: #48bb78;
    border: 1px solid rgba(72, 187, 120, 0.2);
}

.badge-inactiva {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-pendiente {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-cargada {
    background: rgba(66, 153, 225, 0.15);
    color: #4299e1;
    border: 1px solid rgba(66, 153, 225, 0.2);
}

/* Form Elements */
.search-input,
.grid-input,
.inline-input {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    width: 100%;
    outline: none;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.grid-input:focus,
.inline-input:focus,
.inline-input.editable {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 2px rgba(72, 187, 120, 0.2);
    background: #1e293b;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-search {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    background: var(--primary-green);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.2s;
}

.btn-search:hover {
    filter: brightness(1.1);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 800px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-green);
}

.modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

/* Module Tabs */
.module-tabs {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.btn-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.btn-tab.active {
    color: var(--primary-green);
    background: rgba(72, 187, 120, 0.1);
    border-bottom-color: var(--primary-green);
}

/* Autocomplete Suggestions */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 400px;
    max-height: 400px;
    overflow-y: auto;
    background: #1e293b;
    border: 1px solid var(--primary-green);
    border-top: none;
    border-radius: 0 0 12px 12px;
    z-index: 99999;
    display: none;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    margin-top: 1px;
}

.autocomplete-item {
    padding: 14px 18px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #334155;
    border-left: 4px solid var(--primary-green);
}

.autocomplete-item .code {
    color: var(--primary-green);
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Soft Badges */
.badge-soft-success {
    background-color: rgba(72, 187, 120, 0.15);
    color: #68d391;
    border: 1px solid rgba(72, 187, 120, 0.2);
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.badge-soft-warning {
    background-color: rgba(237, 137, 54, 0.15);
    color: #f6ad55;
    border: 1px solid rgba(237, 137, 54, 0.2);
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.badge-soft-danger {
    background-color: rgba(245, 101, 101, 0.15);
    color: #fc8181;
    border: 1px solid rgba(245, 101, 101, 0.2);
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.badge-soft-info {
    background-color: rgba(66, 153, 225, 0.15);
    color: #63b3ed;
    border: 1px solid rgba(66, 153, 225, 0.2);
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

/* Skeleton Loader */
.skeleton {
    background: #2D3748;
    background: linear-gradient(90deg, #2D3748 25%, #4A5568 50%, #2D3748 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
}

.skeleton-text {
    height: 0.8em;
    width: 80%;
    margin-bottom: 4px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Modal Specifics */
#modal-results-table th {
    position: sticky;
    top: 0;
    background: #1e293b;
    z-index: 10;
}

/* FIXED DRAWER OVERLAY */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: none;
    justify-content: flex-end;
}

.drawer-overlay.active {
    display: flex;
}

.drawer-content {
    background: var(--card-bg);
    height: 100%;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: slideLeft 0.3s ease;
}

@keyframes slideLeft {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.drawer-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-close,
.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.drawer-close:hover,
.btn-close:hover {
    color: white;
}