:root {
    --primary-color: #1a237e;
    /* Azul Marino corporativo */
    --primary-light: #534bae;
    --primary-dark: #000051;
    --secondary-color: #0288d1;
    --text-color: #333333;
    --bg-color: #f4f6f8;
    --sidebar-bg: #1a237e;
    --sidebar-text: #ffffff;
    --white: #ffffff;
    --border-color: #e0e0e0;
    --success-color: #4caf50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --font-main: 'Roboto', 'Open Sans', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: fixed;
    height: 100%;
    left: 0;
    top: 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}


.user-profile {
    padding: 0 20px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.company-logo {
    width: 200px;
    height: 100px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 2px;
    background-color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.company-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 4px;
}

.user-name {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Sidebar Navigation (Client Portal Modern) */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 15px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.95rem;
    border-left: none;
    /* Override old style if needed */
}

.nav-link ion-icon,
.nav-link i {
    font-size: 1.3rem;
    margin-right: 12px;
    transition: transform 0.3s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    transform: translateX(5px);
}

.nav-link:hover ion-icon,
.nav-link:hover i {
    transform: scale(1.1);
    color: var(--secondary-color);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link.active ion-icon,
.nav-link.active i {
    color: #4fc3f7;
    /* Lighter blue accent */
}

/* Old Sidebar cleanup if necessary, main-content etc remain */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background-color: rgba(255, 68, 68, 0.1);
    color: #ff8a80;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
    border: 1px solid rgba(255, 68, 68, 0.2);
    cursor: pointer;
    font-weight: 600;
}

.btn-logout:hover {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

/* Main Content */
.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 30px;
    background-color: var(--bg-color);
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 1.8rem;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

/* KPIs */
.kpi-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background-color: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kpi-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Tables */
.table-container {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
    overflow-x: auto;
}

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

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f8f9fa;
    color: #555;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

tbody tr:hover {
    background-color: #f1f5f9;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

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

.modal-content {
    background-color: var(--white);
    margin: 10% auto;
    padding: 30px;
    border-radius: 8px;
    width: 50%;
    max-width: 600px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        margin-top: 5%;
        opacity: 0;
    }

    to {
        margin-top: 10%;
        opacity: 1;
    }
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover {
    color: black;
}

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

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filters .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

/* Map specific */
#map {
    height: 500px;
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

/* Tabs */
.tabs {
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        padding: 10px 0;
    }

    .sidebar-header h2,
    .nav-links span {
        display: none;
    }

    .main-content {
        margin-left: 70px;
    }

    .modal-content {
        width: 90%;
    }

    .split-screen {
        flex-direction: column;
    }

    .left-pane {
        display: none;
    }

    .right-pane {
        width: 100%;
        padding: 20px;
    }
}

/* Login Page Redesign (Split Screen) */
.login-page {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background-color: var(--white);
    display: block;
    /* Override flex from body if needed, but body has min-height: 100vh */
}

.split-screen {
    display: flex;
    height: 100%;
    width: 100%;
}

.left-pane {
    width: 50%;
    background-color: var(--primary-color);
    background-image: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.brand-overlay {
    text-align: center;
    z-index: 2;
}

.brand-logo {
    width: 200px;
    margin-bottom: 10px;
    background: white;
    border-radius: 30px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.brand-overlay h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.brand-overlay p {
    font-size: 1.2rem;
    opacity: 0.8;
}

.right-pane {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--white);
}

.login-wrapper {
    width: 100%;
    max-width: 450px;
    padding: 40px;
}

.login-header-simple {
    margin-bottom: 40px;
}

.login-header-simple h2 {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 10px;
}

.login-header-simple p {
    color: #888;
}

/* Modern Form Groups */
.form-group-modern {
    margin-bottom: 25px;
}

.form-group-modern label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

.input-icon-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 45px;
    /* Space for icon */
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background-color: #f9f9f9;
}

.input-icon-wrapper input:focus {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(26, 35, 126, 0.1);
    outline: none;
}

.input-icon-wrapper input:focus+i {
    color: var(--primary-color);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
}

.checkbox-wrapper input {
    margin-right: 8px;
    width: auto;
}

.forgot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.btn-lg {
    padding: 15px;
    font-size: 1.1rem;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(26, 35, 126, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 35, 126, 0.4);
}

.login-footer {
    margin-top: 40px;
    text-align: center;
    color: #aaa;
    font-size: 0.85rem;
}