:root {
    /* Theme Variables - Modo Noche (Default) */
    --bg-color: #0b1a20; 
    --card-bg: #132730;  
    --sidebar-bg: #10212a; 
    --text-primary: #e2e8f0; 
    --text-secondary: #94a3b8; 
    --primary-color: #38bdf8; 
    --primary-hover: #0ea5e9;
    --error-bg: #dc262620;
    --error-text: #ef4444;
    --success-bg: #10b98120;
    --success-text: #10b981;
    --input-bg: #1a313d; 
    --input-border: #294656; 
    --input-focus: #38bdf8;
    --border-color: rgba(255, 255, 255, 0.08); 
    --header-bg: rgba(16, 33, 42, 0.95);
    --btn-blue: #0284c7;
    --btn-blue-hover: #0369a1;
    
    --font-family: 'Poppins', sans-serif;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --transition-speed: 0.3s;
}



* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* AUTH PAGES STYLE */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(139, 92, 246, 0.15);
}

.login-card h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 30px;
    font-size: 14px;
}

.error-message {
    background-color: var(--error-bg);
    color: var(--error-text);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
    border: 1px solid var(--error-text);
    animation: fadeIn 0.3s ease;
}

.success-message {
    background-color: var(--success-bg);
    color: var(--success-text);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
    border: 1px solid var(--success-text);
    animation: fadeIn 0.3s ease;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--btn-blue); /* Updated label color to blue for Gen view */
}

/* In the auth pages we might still want normal labels */
.login-card .input-group label {
    color: var(--text-secondary);
}

.input-group input, .input-group select, .input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px; /* Sharper corners like the image */
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.input-group input::placeholder, .input-group textarea::placeholder {
    color: #888;
}

.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white; /* static white text for btn */
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.register-link {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.register-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.register-link a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* DASHBOARD LAYOUT */
body.dashboard-body {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 0;
    margin: 0;
}

.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    height: 100vh;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1000;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    font-size: 16px;
    line-height: 1.2;
}

.brand-text {
    color: var(--primary-color);
    font-weight: 800;
    letter-spacing: 1px;
}

.user-handle {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.nav-links {
    list-style: none;
    padding: 20px 0;
    flex-grow: 1;
}

.nav-item {
    padding: 15px 24px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(139, 92, 246, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

.btn-logout-sidebar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: var(--error-text);
    border: 1px solid var(--error-text);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: auto 0.3s;
}

.btn-logout-sidebar:hover {
    background-color: var(--error-text);
    color: white;
}

.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.dashboard-header {
    height: 70px;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}


.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.user-greeting {
    font-weight: 500;
}

.dashboard-inner-content {
    padding: 40px;
    flex-grow: 1;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

/* INICIO TAB */
.dashboard-card.welcome-card {
    background-color: transparent;
    box-shadow: none;
    border: none;
    text-align: left;
    padding: 0;
}

.dashboard-card.welcome-card:hover {
    transform: none;
}

.welcome-text {
    font-size: 32px;
    margin-bottom: 10px;
}

.user-highlight {
    color: var(--primary-color);
}

.dashboard-subtitle {
    text-align: left;
    font-size: 18px;
}  

/* GEN TAB / GENERATOR */
.generator-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px auto 0 auto;
    max-width: 800px;
}

.gen-left {
    width: 100%;
}

.gen-right {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.date-inputs {
    display: flex;
    gap: 10px;
}

.date-inputs select {
    flex: 1;
}

.checkbox-wrapper {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.ccv-qty-row {
    display: flex;
    gap: 20px;
}

.input-group.half {
    flex: 1;
}

.ccv-wrapper {
    display: flex;
    gap: 10px;
}

.btn-generate, .btn-copy {
    background-color: var(--btn-blue);
    margin-top: 0;
    border-radius: 4px;
    padding: 12px;
}

.btn-generate:hover, .btn-copy:hover {
    background-color: var(--btn-blue-hover);
    box-shadow: none;
    transform: none;
}

.result-group {
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.result-group textarea {
    flex-grow: 1;
    resize: none;
    min-height: 350px;
    margin-bottom: 20px;
    font-family: monospace; /* Fuente de codigo para alinear los pipes */
    font-size: 15px; /* Mismo tamaño que los inputs normales */
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: 1px;
    padding: 20px;
    background-color: var(--card-bg);
}

.footer-copyright {
    margin-top: 50px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Sidebar Toggle & Responsive */
.toggle-btn, .mobile-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.toggle-btn:hover, .mobile-toggle-btn:hover {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--primary-color);
}

.mobile-toggle-btn {
    display: none;
    margin-right: 15px;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.mobile-overlay.active {
    display: block;
}

/* Desktop Collapsed Sidebar */
@media (min-width: 769px) {
    .sidebar.collapsed {
        width: 80px;
    }
    .sidebar.collapsed .sidebar-header {
        justify-content: center;
        padding: 24px 0;
    }
    .sidebar.collapsed .sidebar-header h3 {
        display: none;
    }
    .sidebar.collapsed .nav-item {
        justify-content: center;
        padding: 15px 0;
    }
    .sidebar.collapsed .nav-text {
        display: none;
    }
    .sidebar.collapsed .sidebar-footer {
        padding: 24px 10px;
    }
    .sidebar.collapsed .btn-logout-sidebar {
        padding: 10px 0;
    }
    .sidebar.collapsed .btn-logout-sidebar .nav-text {
        display: none;
    }
    .main-content.expanded {
        margin-left: 80px;
        width: calc(100% - 80px);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mobile-toggle-btn {
        display: flex;
    }
    .header-left h2 {
        font-size: 20px;
    }
    .sidebar {
        transform: translateX(-100%);
        width: 250px !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content, .main-content.expanded {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .dashboard-header {
        padding: 0 20px;
    }
    .dashboard-inner-content {
        padding: 20px;
    }
    .ccv-qty-row {
        flex-direction: column;
        gap: 15px;
    }
    .date-inputs {
        flex-wrap: wrap;
    }
    .gen-left, .gen-right {
        min-width: 100%;
    }
}

/* Modal Estilos Generales */
.modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto; 
    padding: 30px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 450px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s ease;
}

.close-modal {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close-modal:hover {
    color: var(--text-primary);
}

.btn-small {
    padding: 4px 10px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-small:hover {
    background-color: var(--primary-hover);
}

/* API List and Buttons */
.api-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 15px;
    padding: 15px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    min-height: 80px;
}

.api-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.api-btn .api-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    text-align: left;
    margin-right: 10px;
}

.api-btn:hover {
    background-color: var(--sidebar-bg);
    border-color: var(--primary-color);
}

.api-btn.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.api-btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    color: inherit;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.api-btn-delete:hover {
    background-color: var(--error-text);
    color: white;
}

.api-btn:not(.active) .api-btn-delete {
    background-color: rgba(0, 0, 0, 0.1);
}
.api-btn:not(.active) .api-btn-delete:hover {
    background-color: var(--error-text);
    color: white;
}

/* Nuevas cajas de resultados ricas (DIV en lugar de TEXTAREA) */
.result-box {
    width: 100%;
    min-height: 450px;
    max-height: 600px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 14px;
    background-color: var(--bg-color);
    border-radius: 4px;
    padding: 12px;
    white-space: pre-wrap; /* Respeta los saltos de línea \n */
}

.result-box.success-box {
    border: 1px solid var(--success-text);
}

.result-box.error-box {
    border: 1px solid var(--error-text);
}

.neon-red {
    color: #ff4d4d;
    text-shadow: 0 0 4px rgba(255, 77, 77, 0.6);
    font-weight: bold;
}

.neon-green {
    color: #00ff88;
    text-shadow: 0 0 4px rgba(0, 255, 136, 0.6);
    font-weight: bold;
}

/* Auth Pages Specific / Light Theme (Day Mode) */
body.auth-page {
    background-color: #2b303a; /* Dark blue-gray for day mode background */
    color: #4a5568; 
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.auth-page .wave-bg {
    position: absolute;
    bottom: -5px; /* slightly hide the gap */
    left: 0;
    width: 100%;
    z-index: -1;
}

body.auth-page .wave-bg svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 350px;
    object-fit: cover;
    object-position: bottom;
}

body.auth-page .wave-bg path {
    fill: #242830; /* Lighter/darker subtle wave for day mode */
}

.auth-page .login-container {
    padding: 20px;
    width: 100%;
    max-width: 420px;
    z-index: 10;
}

.auth-page .login-card {
    background-color: #ffffff; /* White card for day mode */
    border: none;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 40px;
    width: 100%;
}

.auth-page .auth-logo {
    font-size: 64px;
    font-weight: 800;
    text-align: center;
    color: #2d3748; /* Dark grey logo for day mode */
    margin-bottom: 0px;
    letter-spacing: -3px;
    line-height: 1;
}

.auth-page .login-card h2 {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    color: #4a5568; 
    margin-bottom: 25px;
    background: none;
    -webkit-text-fill-color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 25px;
}

.auth-page .input-group label {
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 8px;
    font-weight: 600;
}

.auth-page .input-group input {
    background-color: #f7fafc;
    border: 1px solid #cbd5e0;
    color: #2d3748;
    border-radius: 6px;
    padding: 13px 15px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s;
}

.auth-page .input-group input:focus {
    border-color: #8b5cf6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.auth-page .input-group input::placeholder {
    color: #a0aec0;
}

.auth-page .btn-auth {
    width: 100%;
    background-color: #8b5cf6;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    padding: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 15px;
    transition: background-color 0.2s;
    letter-spacing: 0.5px;
}

.auth-page .btn-auth:hover {
    background-color: #7c3aed;
}

.auth-page .register-link {
    margin-top: 20px;
    text-align: center;
}

.auth-page .btn-secondary-auth {
    display: inline-block;
    width: 100%;
    background-color: transparent;
    color: #4a5568;
    font-weight: 600;
    font-size: 14px;
    padding: 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.auth-page .btn-secondary-auth:hover {
    background-color: #f7fafc;
    color: #2d3748;
}

/* Auth Pages Specific / Dark Theme Layout (Login & Register) */
[data-theme="dark"] body.auth-page {
    background-color: #2c313c; /* Top dark grayish blue */
    color: #e2e8f0;
}

[data-theme="dark"] body.auth-page .wave-bg path {
    fill: #21242d;
}

[data-theme="dark"] .auth-page .login-card {
    background-color: #353b48;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .auth-page .auth-logo {
    color: #ffffff;
}

[data-theme="dark"] .auth-page .login-card h2 {
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .auth-page .input-group label {
    color: #a0aec0;
}

[data-theme="dark"] .auth-page .input-group input {
    background-color: #2f3542;
    border: 1px solid #4b5262;
    color: #e2e8f0;
}

[data-theme="dark"] .auth-page .input-group input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

[data-theme="dark"] .auth-page .input-group input::placeholder {
    color: #718096;
}

[data-theme="dark"] .auth-page .btn-secondary-auth {
    color: #a0aec0;
    border: 1px solid #4b5262;
}

[data-theme="dark"] .auth-page .btn-secondary-auth:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.api-result-item {
    border-top: 1px solid rgba(170, 170, 170, 0.5);
    border-bottom: 1px solid rgba(170, 170, 170, 0.5);
    box-shadow: inset 0 2px 5px rgba(170, 170, 170, 0.1), 0 2px 5px rgba(170, 170, 170, 0.1);
    margin-bottom: 15px;
    padding-top: 5px;
    padding-bottom: 5px;
}

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

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* Spinner Profesional */
.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(139, 92, 246, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Scrollbar Generalizado */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

