:root {
    --accent: #acb900;
    --accent-glow: rgba(172, 185, 48, 0.2);
    --bg-main: #0B0E14;
    --bg-card: rgba(26, 29, 35, 0.6);
    --border-glass: rgba(255, 255, 255, 0.08);
}

body {
    background-color: var(--bg-main) !important;
    color: #E2E8F0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ========== GLASS CARD ========== */
.glass-card {
    background: var(--bg-card) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass) !important;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ========== NAVBAR ========== */
.navbar-thehka {
    background: rgba(15, 17, 26, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    padding: 10px 20px;
}

.navbar-thehka .navbar-brand {
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: -0.5px;
    color: #fff !important;
}

.navbar-thehka .navbar-brand .accent {
    color: var(--accent);
}

.navbar-thehka .badge-bcv {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.4);
    color: #2ecc71;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.navbar-thehka .badge-bcv:hover {
    background: rgba(46, 204, 113, 0.3);
    color: #2ecc71;
}

/* ========== TABS ========== */
.nav-tabs-custom {
    border-bottom: 2px solid var(--border-glass) !important;
    gap: 4px;
}

.nav-tabs-custom .nav-link {
    color: #888 !important;
    border: none !important;
    border-radius: 8px 8px 0 0 !important;
    padding: 10px 20px;
    font-size: 0.95em;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-tabs-custom .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.05);
}

.nav-tabs-custom .nav-link.active {
    color: var(--accent) !important;
    background: rgba(172, 185, 48, 0.1) !important;
    border-bottom: 2px solid var(--accent) !important;
}

/* ========== FORMS ========== */
.form-control, .form-select {
    background-color: rgba(0, 0, 0, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #E2E8F0 !important;
    border-radius: 8px;
    padding: 10px 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

.form-control::placeholder {
    color: #666;
}

.form-label {
    color: #94A3B8;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

/* ========== BUTTONS ========== */
.btn-thehka {
    background: linear-gradient(135deg, var(--accent), #8a9a20);
    color: #000;
    border: none;
    font-weight: 500;
    border-radius: 8px;
    padding: 10px 20px;
    transition: all 0.2s;
}

.btn-thehka:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
    color: #000;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #E2E8F0;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.btn-sm-icon {
    padding: 5px 10px;
    font-size: 0.85em;
    border-radius: 6px;
}

/* ========== TABLES ========== */
.table-thehka {
    color: #E2E8F0;
    margin-bottom: 0;
}

.table-thehka thead th {
    background: rgba(0, 0, 0, 0.2);
    color: #94A3B8;
    font-size: 0.8rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border-glass);
    padding: 12px 10px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table-thehka tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-thehka tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

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

/* ========== BADGES ========== */
.badge-pending {
    background: #f39c12 !important;
    color: #fff !important;
}

.badge-invoiced {
    background: #27ae60 !important;
    color: #fff !important;
}

.badge-anulada {
    background: #95a5a6 !important;
    color: #fff !important;
}

/* ========== ITEMS TABLE (index.php) ========== */
.items-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.items-table th {
    text-align: left;
    padding: 10px 8px;
    color: #aaa;
    font-size: 0.8em;
    background: rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
}

.items-table td {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.items-table input,
.items-table select {
    width: 100%;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 0.9em;
}

.items-table input:focus,
.items-table select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

.items-section {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
}

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

.items-header h3 {
    margin: 0;
    font-size: 1em;
    color: #E2E8F0;
}

.items-table-wrapper {
    overflow-y: auto;
    overflow-x: auto;
    max-height: 300px;
}

.btn-remove {
    background: #e74c3c;
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-remove:hover {
    background: #c0392b;
}

/* ========== TOTALES BOX ========== */
.totales-box {
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.25);
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.total-item {
    text-align: center;
    min-width: 100px;
}

.total-label {
    font-size: 0.75em;
    color: #888;
    margin-bottom: 3px;
}

.total-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #2ecc71;
}

.total-value.grand {
    font-size: 1.3em;
    color: var(--accent);
}

/* ========== AUTOCOMPLETE ========== */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 25, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    z-index: 1050;
    max-height: 250px;
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
    display: none;
}

.autocomplete-dropdown div {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 0.9em;
}

.autocomplete-dropdown div:hover {
    background: rgba(172, 185, 48, 0.2);
}

/* ========== MODAL CUSTOM ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-glass {
    background: rgba(25, 30, 40, 0.95);
    border-radius: 15px;
    padding: 25px;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.modal-glass .btn-close-white {
    filter: invert(1);
}

/* ========== IGTF BOX ========== */
.igtf-box {
    padding: 12px 15px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(231, 76, 60, 0.25);
}

/* ========== TOAST ========== */
.toast-container-custom {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-custom {
    background: rgba(25, 30, 40, 0.95);
    border-left: 4px solid #3B82F6;
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlideIn 0.3s ease forwards;
    backdrop-filter: blur(10px);
}

.toast-custom.success {
    border-color: #27ae60;
}

.toast-custom.error {
    border-color: #e74c3c;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========== BCV PAGE ========== */
.input-group-thehka {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.input-group-thehka .input-group-text-thehka {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px 15px;
    min-width: 150px;
    color: #e2e8f0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9em;
}

.input-group-thehka input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 15px;
    color: #fff;
    outline: none;
    font-size: 1rem;
}

.input-group-thehka input:focus {
    background: rgba(255, 255, 255, 0.05);
}

.api-panel {
    background: linear-gradient(135deg, rgba(0, 184, 148, 0.1) 0%, rgba(0, 206, 201, 0.1) 100%);
    border: 1px solid rgba(0, 184, 148, 0.3);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    display: none;
}

.api-panel h3 {
    color: #00cec9;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.api-data {
    font-size: 1rem;
    margin-bottom: 8px;
    color: #dff9fb;
}

.api-data strong {
    color: #81ecec;
}

/* ========== ACTIONS CELL ========== */
.actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.actions-cell .btn {
    padding: 5px 8px;
    font-size: 0.8em;
    white-space: nowrap;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .navbar-thehka .navbar-brand {
        font-size: 1em;
    }

    .nav-tabs-custom .nav-link {
        padding: 8px 12px;
        font-size: 0.85em;
    }

    .nav-tabs-custom .nav-link .tab-text {
        display: none;
    }

    .totales-box {
        flex-direction: column;
    }

    .totales-box .total-item {
        width: 100%;
    }

    .items-table th,
    .items-table td {
        padding: 6px 4px;
        font-size: 0.8em;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}
