:root {
    --bg-color: #1a1a1a;
    --primary-color: #2d2d2d;
    --secondary-color: #444;
    --text-color: #e0e0e0;
    --accent-color: #00aaff;
    --error-color: #ff4444;
    --success-color: #44ff88;
    --header-height: 60px;
    --header-bg-color: #3c3c3c; /* Gris para el encabezado */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--primary-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    border-bottom: 1px solid var(--secondary-color);
}

.header-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 0.9rem;
    padding: 10px;
    cursor: pointer;
    flex-grow: 1;
    height: 100%;
    border-bottom: 3px solid transparent;
    transition: background-color 0.3s, border-color 0.3s;
}

.header-btn:hover {
    background-color: var(--secondary-color);
}

.header-btn.active {
    border-bottom-color: var(--accent-color);
    font-weight: bold;
}

.content-area {
    padding-top: var(--header-height);
    padding-left: 15px;
    padding-right: 15px;
    padding-bottom: 80px; /* Espacio para botones inferiores */
    height: 100vh;
    overflow-y: auto;
}

.form-container {
    display: none;
    padding-top: 20px;
}

.form-container.active {
    display: block;
}

.data-form .form-group {
    margin-bottom: 15px;
}

.data-form label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #aaa;
}

.data-form input,
.data-form select,
.data-form textarea {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    color: var(--text-color);
    font-size: 1rem;
}

.data-form input:focus,
.data-form select:focus,
.data-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.btn-next, .btn-add, .btn-validate {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 5px;
    background-color: var(--accent-color);
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.btn-next:hover, .btn-add:hover, .btn-validate:hover {
    background-color: #0088cc;
}

.btn-next:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
}

/* Styles for Capture Upload */
#btn-select-capture {
    /* Inherit styles from .btn-add or .btn-next for consistency */
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 5px;
    background-color: var(--accent-color);
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s;
}

#btn-select-capture:hover {
    background-color: #0088cc;
}

.capture-preview-container {
    position: relative;
    width: 250px; /* Base size for the square thumbnail */
    max-width: 100%; /* Ensure it doesn't overflow on smaller screens */
    padding-bottom: 250px; /* This creates the 1:1 aspect ratio (height = width) */
    margin: 10px auto; /* Center the container and provide space */
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    display: none; /* Hidden by default */
    overflow: hidden; /* Hide anything that overflows the square */
    background-color: var(--primary-color); /* Dark background for the box */
    cursor: pointer; /* Add pointer cursor to indicate it's clickable */
}

.capture-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Preserve aspect ratio, fit inside the box */
    /* No border here, it's on the container */
}

/* Smart Search Component for Clients */
.smart-search-container {
    position: relative;
}

.smart-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--primary-color);
    border: 1px solid var(--secondary-color);
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001; /* Above other content */
}

.smart-search-results .result-item {
    padding: 18px 12px; /* Increased vertical padding for better mobile usability */
    cursor: pointer;
    color: var(--text-color);
    font-size: 0.9rem;
}

.smart-search-results .result-item:hover {
    background-color: var(--accent-color); /* Accent blue on hover */
    color: #fff; /* White text on blue hover */
}

/* Formulario 2: Facturas */
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: var(--primary-color);
    border-radius: 5px;
    overflow: hidden;
    table-layout: fixed;
}

.invoice-table thead {
    background-color: var(--header-bg-color);
}

.invoice-table th {
    padding: 12px 15px;
    text-align: left;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: bold;
}

.invoice-table th:nth-child(1) { width: 35%; }
.invoice-table th:nth-child(2) { width: 25%; }
.invoice-table th:nth-child(3) { width: 25%; }
.invoice-table th:nth-child(4) { width: 15%; }

.invoice-table th .remaining-amount {
    display: block;
    font-size: 0.8em;
    font-weight: normal;
    color: var(--accent-color);
}

.invoice-table tbody tr {
    border-bottom: 1px solid var(--secondary-color);
}

.invoice-table tbody tr:last-child {
    border-bottom: none;
}

.invoice-table td {
    padding: 10px 2px;
    vertical-align: middle;
}

.invoice-table td input,
.invoice-table td select {
    width: 100%;
    padding: 8px;
    background-color: var(--bg-color);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    color: var(--text-color);
    font-size: 0.9rem;
    box-sizing: border-box;
}

.invoice-table td input:focus,
.invoice-table td select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Final attempt: High-specificity rule for the invoice select */
.invoice-table td select.invoice-number {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: var(--bg-color) !important;
    border: 1px solid var(--secondary-color) !important;
    border-radius: 5px !important;
    color: var(--text-color) !important;
    padding: 8px !important;
    padding-right: 30px !important; /* Make space for the arrow */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23e0e0e0%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E') !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 12px !important;
}

.invoice-table td select.invoice-number:focus {
    outline: none !important;
    border-color: var(--accent-color) !important;
}

.invoice-table td input.invoice-bs,
.invoice-table td input.invoice-usd {
    text-align: right !important;
    -moz-appearance: textfield !important;
}

.invoice-table td input.invoice-bs::-webkit-outer-spin-button,
.invoice-table td input.invoice-bs::-webkit-inner-spin-button,
.invoice-table td input.invoice-usd::-webkit-outer-spin-button,
.invoice-table td input.invoice-usd::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* Hide spinners for number inputs globally */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

.invoice-table td .btn-remove-invoice {
    background-color: var(--error-color);
    color: white;
    border: none;
    border-radius: 5px; /* Square corners */
    width: 30px;
    height: 30px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.invoice-table td .btn-remove-invoice:hover {
    background-color: #cc0000;
}

/* --- OCR Loader Styles --- */
.ocr-loader-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: var(--text-color);
    font-size: 1.2rem;
}

.ocr-loader-overlay.visible {
    display: flex;
}

.ocr-loader-spinner {
    border: 4px solid var(--secondary-color);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Modal Zoom Styles --- */
.modal-zoom-container {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.modal-zoom-container.visible {
    display: flex;
}

.modal-zoom-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.2s ease-in-out;
    cursor: zoom-in;
}

/* --- Cedula/RIF Input Group --- */
.cedula-rif-container {
    display: flex;
    align-items: center;
    gap: 5px; /* Adds a small space between the select and input */
}

.cedula-rif-container select {
    width: auto; /* Let the select be as wide as its content */
    flex-grow: 0;
    flex-shrink: 0;
    padding-right: 30px; /* Ensure space for the dropdown arrow */
}

.cedula-rif-container input {
    flex-grow: 1; /* Allow the input to take the remaining space */
    width: 100%; /* Ensure it tries to fill the container */
}

/* --- Telefono Input Group --- */
.telefono-container {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    font-size: 1rem;
}

.telefono-container:focus-within {
    border-color: var(--accent-color);
}

.telefono-container span {
    color: #aaa; /* Lighter color for the static prefix */
    padding-right: 5px;
    border-right: 1px solid var(--secondary-color);
    margin-right: 5px;
}

.telefono-container select,
.telefono-container input {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: inherit;
    padding: 0;
}

.telefono-container select {
    width: auto;
    flex-shrink: 0;
}

.telefono-container input {
    flex-grow: 1;
    width: 100%;
}

/* --- Bank Verification Modal --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 2500; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
}

.modal-content {
    background-color: var(--primary-color);
    margin: 15% auto; /* 15% from the top and centered */
    padding: 20px;
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    width: 80%; /* Could be more or less, depending on screen size */
    max-width: 600px;
    position: relative;
    color: var(--text-color);
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
}

#bank-verification-result pre {
    background-color: var(--bg-color);
    padding: 15px;
    border-radius: 5px;
    border: 1px solid var(--secondary-color);
    white-space: pre-wrap;       /* Since CSS 2.1 */
    white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
}

/* --- Hamburger Menu Button --- */
.hamburger-menu-btn {
    font-size: 1.5em;
    padding: 5px 10px;
    margin-right: 15px;
    background-color: transparent;
    border: none;
    color: var(--text-color); /* Corrected variable name */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger-menu-btn:hover {
    color: var(--accent-color); /* Corrected variable name */
}

/* --- Sidebar Menu Styles --- */
.sidebar-menu {
    height: 100%;
    width: 0; /* Initially hidden */
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    background-color: var(--primary-color);
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 60px;
    color: var(--text-color);
    border-right: 1px solid var(--secondary-color);
    display: flex;
    flex-direction: column;
}

.sidebar-menu.visible {
    width: 250px;
}

.sidebar-menu .close-btn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
}

.sidebar-menu .user-info {
    padding: 15px 25px;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--secondary-color);
    margin-bottom: 10px;
}

.sidebar-menu .menu-item {
    padding: 15px 25px;
    text-decoration: none;
    font-size: 1rem;
    color: var(--text-color);
    display: block;
    transition: 0.3s;
}

.sidebar-menu .menu-item:hover {
    background-color: var(--secondary-color);
    color: var(--accent-color);
}

/* --- Sidebar Overlay Styles --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1999;
}

.sidebar-overlay.visible {
    display: block;
}

/* --- Analysis Modal Styles --- */
.analysis-table-container {
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    margin-top: 20px;
}

.analysis-table {
    width: 100%;
    border-collapse: collapse;
}

.analysis-table .client-header {
    background-color: var(--header-bg-color);
    text-align: left;
}

.analysis-table .client-header th {
    padding: 12px 15px;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.analysis-table .invoice-row td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--secondary-color);
    font-size: 0.9rem;
}

.analysis-table .invoice-row td:last-child {
    text-align: right;
    font-weight: bold;
}

/* --- Uploads Report Modal Styles --- */
.uploads-report-container {
    max-height: 70vh; /* Mayor altura vertical */
    overflow: auto; /* Scrollbars vertical y horizontal si es necesario */
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    margin-top: 20px;
    font-size: 0.8rem; /* Fuente más pequeña para la tabla */
}

.uploads-report-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap; /* Evita que el texto se divida en varias líneas */
}

.uploads-report-table th,
.uploads-report-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--secondary-color);
}

.uploads-report-table thead {
    background-color: var(--header-bg-color);
    position: sticky;
    top: 0; /* Fija la cabecera al hacer scroll vertical */
    z-index: 1;
}

.uploads-report-table td:nth-child(3), /* Monto Bs */
.uploads-report-table td:nth-child(4), /* Monto Usd */
.uploads-report-table td:nth-child(5) { /* Tasa */
    text-align: right;
}

/* --- Verification Capture Styles --- */
.verification-capture-container {
    width: 100%;
    margin-top: 10px;
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    overflow: hidden;
}

.verification-capture-image {
    width: 100%;
    height: auto; /* Mantiene la proporción */
    display: block;
}

/* --- Verification Success Styles --- */
.verification-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.checkmark-svg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 3;
    stroke: var(--success-color);
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px var(--success-color);
    animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
    margin-bottom: 20px;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 3;
    stroke-miterlimit: 10;
    stroke: var(--success-color);
    fill: none;
    animation: stroke .6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke .3s cubic-bezier(0.65, 0, 0.45, 1) .8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes fill {
    100% {
        box-shadow: inset 0px 0px 0px 40px var(--success-color);
    }
}

.verification-success p {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--success-color);
}
/* Estilos para la animación de la X de error */
.verification-error {
    text-align: center;
}

.cross-svg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #E74C3C; /* Rojo para el error */
    stroke-miterlimit: 10;
    margin: 10% auto;
    box-shadow: inset 0px 0px 0px #E74C3C;
    animation: fill-red .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
}

.cross-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #E74C3C;
    fill: none;
    animation: stroke .6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.cross-path {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke .3s cubic-bezier(0.65, 0, 0.45, 1) .8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes fill-red {
    100% {
        box-shadow: inset 0px 0px 0px 60px #E74C3C;
    }
}


/* Estilos para el select del prefijo de teléfono en modo oscuro */
#telefono-operadora {
    background-color: var(--primary-color);
    color: var(--text-color);
}

