/* Variables de Color */
:root {
    --primary-blue: #346cf5;
    --primary-dark: #1e4bb5;
    --light-blue: #e5edfe;
    --dark-gray: #333333;
    --medium-gray: #777777;
    --light-gray: #e0e0e0;
    --border-color: #dddddd;
    --white: #ffffff;
    --off-white: #f4f7fa;
    --success-green: #28a745;
    --danger-red: #dc3545;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

/* Tipografía */
body {
    font-family: 'Inter', 'Roboto', 'Arial', sans-serif;
    color: var(--dark-gray);
    margin: 0;
    background-color: var(--off-white);
    line-height: 1.5;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

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

.modal-content {
    background: var(--white);
    width: 500px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

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

.modal-header {
    background: var(--primary-blue);
    color: var(--white);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.close-modal {
    background: none;
    border: none;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.search-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input-group input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.client-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.client-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.client-item:last-child {
    border-bottom: none;
}

.client-item:hover {
    background-color: var(--light-blue);
}

.client-item .client-name {
    font-weight: bold;
    display: block;
}

.client-item .gps-btn {
    background: none;
    border: none;
    color: var(--primary-blue);
    cursor: pointer;
    padding: 0 8px;
    font-size: 14px;
    transition: var(--transition);
}

.gps-btn:hover {
    color: var(--dark-blue);
    transform: scale(1.1);
}

.tab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tab-table th {
    background: var(--light-gray);
    color: var(--medium-gray);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.tab-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.tab-table input, .tab-table select {
    width: 100%;
    border: 1px solid transparent;
    padding: 5px;
    font-size: 13px;
}

.tab-table input:focus {
    border-color: var(--primary-blue);
    outline: none;
    background: white;
}

/* Calendar View Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.calendar-sidebar {
    background: var(--light-gray);
    border-right: 1px solid var(--border-color);
}

.calendar-header-cell {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-align: center;
    font-size: 11px;
    font-weight: 600;
}

.calendar-day-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-slot-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    font-size: 9px;
    color: var(--medium-gray);
}

.unit-row {
    height: 50px;
    display: grid;
    grid-template-columns: 200px 1fr;
    border-bottom: 1px solid var(--border-color);
}

.unit-info {
    padding: 10px;
    font-size: 12px;
    border-right: 1px solid var(--border-color);
    background: var(--white);
    display: flex;
    align-items: center;
}

.timeline-canvas {
    position: relative;
    background-image: linear-space(90deg, #eee 1px, transparent 1px);
    background-size: calc(100% / 14); /* 7 days * 2 slots */
}

.res-bar {
    position: absolute;
    height: 30px;
    top: 10px;
    background: var(--primary-blue);
    color: white;
    font-size: 10px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--medium-gray);
}

/* Generic Table Styles */
.data-table-container {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 20px;
    overflow: hidden;
}

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

.data-table th {
    background-color: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-size: 12px;
    color: var(--medium-gray);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tr:hover {
    background-color: #fcfcfc;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.open { background: #e3f2fd; color: #1976d2; }
.status-badge.confirmed { background: #e8f5e9; color: #2e7d32; }

/* Sidebar consistency */
.sidebar-nav-item a {
    text-decoration: none;
    color: inherit;
    width: 100%;
    display: flex;
    align-items: center;
}

.title {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-blue);
    text-transform: uppercase;
}

.sidebar-item-text {
    font-size: 14px;
}

.sidebar-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    width: 100%;
}

.chart-label {
    font-size: 14px;
    color: var(--dark-gray);
}

.config-label {
    font-size: 12px;
    color: var(--medium-gray);
    text-transform: uppercase;
    margin-top: 20px;
    margin-bottom: 10px;
    padding-left: 20px;
}

/* Layout General */
.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--white);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    padding-top: 20px;
    flex-shrink: 0;
}

.logo-section {
    display: flex;
    align-items: center;
    padding: 0 20px 25px 20px;
    border-bottom: 1px solid var(--light-gray);
    margin-bottom: 20px;
}

.logo-icon {
    width: 30px;
    height: 30px;
    background-color: var(--primary-blue);
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 10px;
    color: var(--white);
    font-size: 18px; /* Placeholder for an icon */
}

.logo-text {
    font-size: 20px;
    font-weight: bold;
    color: var(--dark-gray);
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.sidebar-nav-item:hover {
    background-color: var(--light-blue);
}

.sidebar-nav-item.active {
    background-color: var(--light-blue);
    color: var(--primary-blue);
    font-weight: bold;
}

.sidebar-nav-item.active .sidebar-icon {
    color: var(--primary-blue);
}

.sidebar-icon {
    margin-right: 10px;
    color: var(--medium-gray);
    font-size: 18px; /* Placeholder for icons */
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--white);
    padding: 18px 25px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border-radius: 12px; /* Increased for a more modern look */
}

.search-bar {
    display: flex;
    align-items: center;
    border: 1px solid var(--light-gray);
    border-radius: 5px;
    padding: 8px 10px;
    background-color: var(--white);
}

.search-bar input {
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--dark-gray);
    padding-left: 5px;
}

.search-bar input::placeholder {
    color: var(--medium-gray);
}

.header-icons {
    display: flex;
    align-items: center;
}

.header-icon {
    margin-left: 20px;
    color: var(--medium-gray);
    font-size: 20px; /* Placeholder for icons */
    cursor: pointer;
}

.header-icon.active {
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
    border-radius: 50%;
    padding: 8px;
}

/* Content Header (below main header) */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.date-picker {
    display: flex;
    align-items: center;
    border: 1px solid var(--light-gray);
    border-radius: 5px;
    padding: 8px 10px;
    background-color: var(--white);
}

.date-picker input {
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--dark-gray);
    width: 90px;
}

.date-picker input::placeholder {
    color: var(--medium-gray);
}

.date-picker-icon {
    color: var(--medium-gray);
    margin-left: 5px;
}

/* Card */
.card {
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    padding: 20px;
}

/* Chart Specific Styles */
.chart-container {
    padding-top: 20px;
    height: 300px; /* Example height */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.chart-grid {
    position: absolute;
    top: 0;
    left: 40px; /* Adjust based on y-axis labels */
    right: 20px;
    bottom: 40px; /* Adjust based on x-axis labels */
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* Example: 6 points on x-axis */
    grid-template-rows: repeat(6, 1fr); /* Example: 6 points on y-axis */
    border-left: 1px solid var(--light-gray);
    border-bottom: 1px solid var(--light-gray);
}

.chart-grid-line-x {
    border-top: 1px dashed var(--light-gray);
    grid-column: 1 / -1;
}

.chart-grid-line-y {
    border-right: 1px dashed var(--light-gray);
    grid-row: 1 / -1;
}

.y-axis-labels {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 40px;
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-between;
    width: 40px;
    text-align: right;
    padding-right: 5px;
}

.x-axis-labels {
    position: absolute;
    left: 40px;
    right: 20px;
    bottom: 0;
    display: flex;
    justify-content: space-around;
    padding-top: 5px;
}

.chart-line-area {
    position: absolute;
    bottom: 40px;
    left: 40px;
    right: 20px;
    top: 0;
    /* This will be complex to replicate purely with CSS.
       For a real chart, you'd use SVG, Canvas, or a charting library.
       Here, it's a placeholder. */
    background: linear-gradient(to top, rgba(229, 237, 254, 0.8), rgba(229, 237, 254, 0));
    border-bottom: 2px solid var(--primary-blue); /* Base line */
    /* Further styling to mimic the curve would require more advanced techniques */
}

.chart-point {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--primary-blue);
    border: 2px solid var(--white);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* Presupuestos Page Styles */
.page-tabs {
    display: flex;
    border-bottom: 1px solid var(--light-gray);
    margin-bottom: 20px;
    gap: 5px;
}

.page-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--medium-gray);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-tab.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
    background-color: var(--white);
}

.tab-close {
    font-size: 12px;
}

.budget-card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.budget-toolbar {
    padding: 10px 15px;
    border-bottom: 1px solid var(--light-gray);
    background-color: #fafafa;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-btn {
    background: none;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--dark-gray);
}

.btn-save {
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

.status-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--medium-gray);
    margin-left: 10px;
}

.budget-form {
    padding: 20px;
}

.form-row {
    display: grid;
    gap: 20px;
    margin-bottom: 15px;
}

.three-cols { grid-template-columns: repeat(3, 1fr); }
.four-cols { grid-template-columns: repeat(4, 1fr); }
.three-cols-variant { grid-template-columns: 2fr 1fr 1fr; }

.span-2 { grid-column: span 2; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 11px;
    font-weight: bold;
    color: var(--medium-gray);
    text-transform: uppercase;
}

.form-group input, 
.form-group select {
    padding: 8px 10px;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    background-color: #fff;
}

.form-group input[readonly] {
    background-color: #f5f5f5;
    color: var(--medium-gray);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    width: 100%;
    padding-right: 30px;
}

.input-with-icon i {
    position: absolute;
    right: 10px;
    color: var(--medium-gray);
    font-size: 14px;
}

.input-with-select {
    display: flex;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    overflow: hidden;
}

.input-with-select input {
    border: none;
    flex-grow: 1;
}

.input-with-select select {
    border: none;
    border-left: 1px solid var(--light-gray);
    background-color: #f9f9f9;
    padding: 0 5px;
    font-size: 12px;
}

.sub-tabs {
    display: flex;
    padding: 0 20px;
    border-bottom: 1px solid var(--light-gray);
    margin-top: 10px;
}

.sub-tab {
    padding: 10px 15px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 12px;
    font-weight: bold;
    color: var(--medium-gray);
    cursor: pointer;
}

.sub-tab.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
}

.tab-content {
    padding: 0;
}

.tab-pane {
    display: none;
}

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

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

.budget-table th {
    text-align: left;
    padding: 10px 20px;
    font-size: 12px;
    color: var(--medium-gray);
    background-color: #fff;
    border-bottom: 1px solid var(--light-gray);
}

.budget-table td {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.budget-table td.required {
    color: #a0a0a0;
    font-style: italic;
}

.table-actions {
    padding: 10px 20px;
}

.table-btn {
    background: none;
    border: none;
    color: var(--medium-gray);
    cursor: pointer;
}

.table-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 30px;
    padding: 15px 20px;
    background-color: #f9f9f9;
    border-top: 1px solid var(--light-gray);
}

.total-text {
    color: var(--primary-blue);
    font-weight: bold;
    font-size: 14px;
}

.km-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--medium-gray);
}

.km-info input {
    width: 40px;
    padding: 4px;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    text-align: center;
}

.totals-section {
    padding: 20px;
    border-top: 2px solid var(--primary-blue);
    margin-top: 20px;
}

.total-bruto-toggle {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.total-bruto-toggle span {
    font-size: 13px;
}

/* Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-blue);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

.budget-footer {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background-color: #f5f5f5;
    border-top: 1px solid var(--light-gray);
}

.footer-btn {
    background: none;
    border: none;
    color: var(--medium-gray);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer-btn:hover {
    color: var(--dark-gray);
}
