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

:root {
    --primary-color: #0066cc;
    --primary-dark: #004a99;
    --primary-light: #e6f0ff;
    --secondary-color: #f39200;
    --success-color: #00a86b;
    --danger-color: #cc0000;
    --warning-color: #ff6b6b;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #dddddd;
    --bg-light: #f8f9fa;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffffff;
    color: var(--text-dark);
    line-height: 1.6;
}

/* ==================== LOGIN PAGE ==================== */
.page {
    display: none !important;
    min-height: 100vh;
}

.page.active {
    display: flex !important;
    flex-direction: column;
}

#loginPage {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    transition: background 0.5s ease;
}

#loginPage.admin-mode {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #003366 100%);
}

#loginPage.admin-mode .login-container {
    filter: brightness(1.05);
}

#adminPage, #agentPage {
    display: none !important;
    flex-direction: column;
}

#adminPage.active, #agentPage.active {
    display: flex !important;
    flex-direction: column;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    border-top: 5px solid transparent;
    transition: all 0.3s ease;
}

.login-box.admin-mode {
    border-top: 5px solid var(--primary-dark);
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.25);
}

.top-right-admin-link {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 100;
}

#loginPage.active .top-right-admin-link {
    z-index: 1000;
}

.discrete-admin-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 20px;
    font-weight: 400;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: inline-block;
    white-space: nowrap;
}

.discrete-admin-link:hover {
    color: white;
    transform: scale(1.05);
}

.discrete-admin-link.active {
    color: white;
    background-color: var(--primary-color);
    opacity: 1;
    padding: 8px 16px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
    transform: scale(1);
}

.discrete-admin-link.active:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.6);
}

.admin-link-container {
    display: none;
}

.login-box h1 {
    color: var(--primary-color);
    font-size: 32px;
    margin-bottom: 5px;
    text-align: center;
    transition: color 0.3s ease;
}

.login-box.admin-mode h1 {
    color: var(--primary-dark);
}

.mode-indicator {
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
    text-transform: uppercase;
}

.login-box.admin-mode .mode-indicator {
    opacity: 1;
    color: var(--primary-dark);
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

#loginPage.admin-mode .form-group input {
    border-color: var(--primary-dark);
    background-color: #f0f5ff;
}

#loginPage.admin-mode .form-group input:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2);
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#loginPage.admin-mode .btn-primary {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #003366 100%);
    box-shadow: 0 4px 12px rgba(0, 74, 153, 0.3);
}

#loginPage.admin-mode .btn-primary:hover {
    background: linear-gradient(135deg, #003366 0%, #001a33 100%);
    box-shadow: 0 6px 16px rgba(0, 74, 153, 0.4);
}

.btn-secondary {
    background-color: #f0f0f0;
    color: var(--text-dark);
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #990000;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

/* ==================== NAVBAR ==================== */
.navbar {
    background-color: var(--primary-color);
    color: white;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    box-shadow: var(--shadow);
}

.navbar-brand {
    font-size: 24px;
    font-weight: bold;
}

.navbar-menu {
    display: flex;
    gap: 30px;
    align-items: center;
}

.login-version {
    text-align: center;
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-light);
    letter-spacing: 0.03em;
}

.version-badge {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: normal;
    letter-spacing: 0.03em;
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 2px 7px;
    border-radius: 10px;
}

.nav-btn, .logout-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.nav-btn.active {
    background-color: rgba(255, 255, 255, 0.3);
    border-bottom: 3px solid white;
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.2);
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.welcome-text {
    color: white;
    font-size: 14px;
}

/* ==================== ADMIN DASHBOARD ==================== */
.admin-container {
    width: 100%;
    margin: 0;
    padding: 20px 10px;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 28px;
}

.section h3 {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 18px;
}

/* Create Agent Form */
.create-agent-form {
    background-color: var(--bg-light);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 40px;
    border-left: 4px solid var(--primary-color);
}

.create-agent-form form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 20px;
    align-items: flex-end;
}

.create-agent-form .form-group {
    margin-bottom: 0;
}

.create-agent-form .btn {
    width: 100%;
}

/* Agents List */
.agents-list {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.agent-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.agent-search-bar label {
    font-size: 14px;
    color: var(--text-dark);
    font-weight: 600;
    margin: 0;
}

.agent-search-bar input {
    flex: 1;
    max-width: 420px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.agent-search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.12);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

thead {
    background-color: var(--primary-light);
}

th {
    padding: 15px;
    text-align: left;
    color: var(--primary-color);
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background-color: var(--bg-light);
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background-color: #e6ffe6;
    color: var(--success-color);
}

.status-inactive {
    background-color: #ffe6e6;
    color: var(--danger-color);
}

.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
}

.action-buttons button {
    padding: 5px 10px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 100px;
    max-width: 180px;
}

/* Settings Form */
.settings-form {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-width: 500px;
}

.settings-form form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-text {
    background-color: var(--primary-light);
    padding: 15px;
    border-radius: 4px;
    color: var(--primary-color);
    font-size: 13px;
    margin-top: 10px;
}

/* ==================== EXCELS LIST TABLE ==================== */
.excels-list {
    background-color: white;
    padding: 15px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

#excelTable {
    table-layout: fixed;
    word-break: break-word;
}

/* col 1: Empresa */
#excelTable th:nth-child(1),
#excelTable td:nth-child(1) {
    width: 14%;
}

/* col 2: CIF */
#excelTable th:nth-child(2),
#excelTable td:nth-child(2) {
    width: 8%;
    white-space: nowrap;
}

/* col 3: Email Contacto Técnico */
#excelTable th:nth-child(3),
#excelTable td:nth-child(3) {
    width: 18%;
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* col 4: Agente */
#excelTable th:nth-child(4),
#excelTable td:nth-child(4) {
    width: 8%;
}

/* col 5: Fecha Solicitud */
#excelTable th:nth-child(5),
#excelTable td:nth-child(5) {
    width: 12%;
    white-space: nowrap;
}

/* col 6: Estado */
#excelTable th:nth-child(6),
#excelTable td:nth-child(6) {
    width: 26%;
}

/* col 7: Acciones */
#excelTable th:nth-child(7),
#excelTable td:nth-child(7) {
    width: 14%;
    white-space: nowrap;
}

/* ==================== AGENT DASHBOARD ==================== */
.agent-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 30px;
}

.company-form-wrapper {
    background-color: white;
    padding: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.company-form-wrapper h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 28px;
}

fieldset {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    background-color: #f9f9fb;
    transition: all 0.3s ease;
}

fieldset:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.1);
}

legend {
    color: var(--primary-color);
    font-weight: 700;
    padding: 0 15px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#companyForm .form-group {
    margin-bottom: 20px;
}

#companyForm .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    #companyForm .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

#companyForm .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
}

#companyForm input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

#companyForm input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Employees Section */
.employees-container {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    border-radius: 6px;
    background-color: #ffffff;
}

.employee-input-group {
    display: grid;
    grid-template-columns: 1.5fr 1fr auto;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
    padding: 12px;
    background-color: #f9f9fb;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.employee-input-group:hover {
    border-color: var(--primary-color);
    background-color: #f5f9ff;
}

.employee-email, .employee-phone {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.employee-email:focus, .employee-phone:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

#addEmployeeBtn {
    width: 100%;
    margin-bottom: 15px;
    background-color: var(--bg-light);
    border: 2px dashed var(--primary-color);
    color: var(--primary-color);
    transition: all 0.3s ease;
}

#addEmployeeBtn:hover {
    background-color: var(--primary-light);
    border-style: solid;
}

.employee-count {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 15px;
    font-weight: 500;
}

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

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
}

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

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 15px;
    }

    .navbar-menu {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .nav-btn, .logout-btn {
        width: 100%;
        text-align: center;
    }

    .create-agent-form form {
        grid-template-columns: 1fr;
    }

    .agent-search-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .agent-search-bar input {
        width: 100%;
        max-width: none;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 10px;
    }

    .admin-container {
        padding: 20px;
    }

    .agent-container {
        padding: 20px;
    }

    .company-form-wrapper {
        padding: 20px;
    }

    fieldset {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 20px;
    }

    .login-box h1 {
        font-size: 24px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }

    .employee-input-group {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .action-buttons button {
        min-width: 90px;
        font-size: 10px;
    }
}
/* ==================== BADGES ==================== */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.badge-gray {
    background-color: #e8e8e8;
    color: #666;
}

.badge-blue {
    background-color: #d4e6f1;
    color: #0066cc;
}

.badge-orange {
    background-color: #fde5d0;
    color: #ff6b00;
}

.badge-green {
    background-color: #d4edda;
    color: #00a86b;
}

.badge-yellow {
    background-color: #fff3cd;
    color: #856404;
}

.badge-red {
    background-color: #f8d7da;
    color: #c0392b;
}

/* ==================== BUTTON STYLES ==================== */
.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: #d68910;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover:not(:disabled) {
    background-color: #138496;
}

.btn-info:disabled {
    background-color: #9ecccf;
    cursor: not-allowed;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #218838;
}

.btn-success:disabled {
    background-color: #9fce9f;
    cursor: not-allowed;
}