/* Variables CSS */
:root {
    --primary-color: #FF6B35;
    --secondary-color: #004E89;
    --accent-color: #F7B801;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--gray-100);
}

/* Contenedores */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    width: 100%;
    padding: 0 20px;
}

/* Header / Navbar */
.navbar {
    background-color: var(--white);
    box-shadow: var(--box-shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.navbar-menu a {
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.navbar-menu a:hover {
    color: var(--primary-color);
}

/* Botones */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background-color: #e55a2b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

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

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

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

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

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: var(--white);
    padding: 5rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Buscador */
.search-box {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    margin: -3rem auto 3rem;
    max-width: 900px;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

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

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
}

.form-control {
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--gray-200);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.card-text {
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background-color: var(--success-color);
    color: var(--white);
}

.badge-warning {
    background-color: var(--warning-color);
    color: var(--white);
}

.badge-info {
    background-color: var(--secondary-color);
    color: var(--white);
}

/* Formularios */
.form-container {
    max-width: 500px;
    margin: 3rem auto;
    background-color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.form-container h2 {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Footer */
.footer {
    background-color: var(--dark-color);
    color: var(--white);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

/* Utilidades */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Loading Spinner */
.spinner {
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

/* Avatar de perfil */
.avatar-nav {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    vertical-align: middle;
}

.avatar-lg {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    display: block;
    margin: 0 auto;
}

.avatar-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.avatar-edit-overlay {
    position: absolute;
    bottom: 6px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    text-align: center;
    font-size: 0.7rem;
    padding: 4px 0;
    border-radius: 0 0 65px 65px;
    opacity: 0;
    transition: opacity 0.2s;
}

.avatar-wrapper:hover .avatar-edit-overlay {
    opacity: 1;
}

/* Tarjeta de perfil */
.profile-card {
    max-width: 600px;
    margin: 3rem auto;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2.5rem;
}

.profile-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.profile-header h2 {
    margin-top: 0.75rem;
    font-size: 1.5rem;
}

.profile-header .role-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

.profile-info-row {
    display: flex;
    align-items: center;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--gray-200);
    gap: 1rem;
}

.profile-info-row:last-of-type {
    border-bottom: none;
}

.profile-info-label {
    width: 130px;
    min-width: 130px;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.profile-info-value {
    color: var(--dark-color);
}

/* ── Mapa tipo Booking.com ───────────────────────────────────────────────── */
.map-toggle-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.map-count {
    font-size: 0.95rem;
    color: var(--gray-600);
    font-weight: 400;
    margin-left: 0.5rem;
}

.map-view-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-view {
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: var(--white);
    color: var(--gray-700);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-view:hover,
.btn-view.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #fff5f2;
}

/* Layout split: sidebar + mapa */
.map-layout {
    display: flex;
    height: calc(100vh - 130px);
    gap: 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.map-sidebar {
    width: 42%;
    min-width: 320px;
    overflow-y: auto;
    background: var(--gray-100);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.map-panel {
    flex: 1;
    position: relative;
}

#leafletMap {
    width: 100%;
    height: 100%;
}

/* Tarjeta compacta en el sidebar del mapa */
.map-sidebar-card {
    display: flex;
    gap: 0.75rem;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.map-sidebar-card:hover,
.map-sidebar-card.highlighted {
    border-color: var(--primary-color);
    box-shadow: 0 2px 12px rgba(255, 107, 53, 0.15);
}

.map-card-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: var(--gray-200);
}

.map-card-info {
    flex: 1;
    min-width: 0;
}

.map-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--dark-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-card-meta {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin: 2px 0;
}

.map-card-location {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.map-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-card-price {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1rem;
}

.map-card-price small {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.map-card-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.map-card-badge.avail {
    background: #d4edda;
    color: #155724;
}

.map-card-badge.unavail {
    background: #e9ecef;
    color: var(--gray-600);
}

/* Marcador de precio en el mapa */
.map-price-marker {
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.82rem;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: inline-block;
}

.map-price-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

/* Popup del mapa */
.map-popup {
    font-family: var(--font-family);
    min-width: 220px;
}

.map-popup strong {
    font-size: 0.95rem;
    display: block;
    margin-bottom: 2px;
}

/* Toggle de vista en la barra de resultados */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ===== DASHBOARD KPIs ===== */
.dashboard-welcome {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.25rem;
    text-align: center;
    border-top: 4px solid var(--gray-400);
}

.kpi-card.kpi-green { border-top-color: var(--success-color); }
.kpi-card.kpi-orange { border-top-color: var(--warning-color); }
.kpi-card.kpi-blue { border-top-color: var(--secondary-color); }
.kpi-card.kpi-loading { color: var(--gray-600); font-style: italic; }

.kpi-icon { font-size: 2rem; margin-bottom: 0.25rem; }
.kpi-icon-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gray-400);
    line-height: 1;
}
.kpi-value { font-size: 1.75rem; font-weight: 700; color: var(--dark-color); }
.kpi-label { font-size: 0.8rem; color: var(--gray-600); margin-top: 0.25rem; }

.dashboard-section {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.dashboard-section h3 { margin-bottom: 1rem; }

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recent-booking-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
    gap: 1rem;
}

.recent-booking-row:last-child { border-bottom: none; }
.recent-booking-info { flex: 1; }

/* ===== MODALES GENÉRICOS ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.modal-dialog {
    background: var(--white);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.modal-dialog.modal-lg { max-width: 780px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 { margin: 0; font-size: 1.1rem; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--gray-600);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.modal-close:hover { background: var(--gray-200); }

.modal-body { padding: 1.25rem 1.5rem; }

/* Form helpers */
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.82rem; }

/* ===== GESTIONAR MAQUINARIA ===== */
.manage-machinery-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.manage-card-img-wrap {
    position: relative;
    height: 180px;
    background: var(--gray-200);
    overflow: hidden;
}

.manage-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.manage-card-status {
    position: absolute;
    top: 8px;
    left: 8px;
}

.manage-card-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

/* ===== DETALLE MAQUINARIA ===== */
.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    padding: 0.75rem;
}

.detail-info-grid > div {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== DISPONIBILIDAD ===== */
.availability-section {
    background: var(--gray-100);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.avail-date-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.avail-calendar-wrap { }

.avail-days-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0.5rem 0;
}

.avail-day {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: default;
}

.avail-day-ok { background: #d4edda; color: #155724; }
.avail-day-booked { background: #f8d7da; color: #721c24; }
.avail-day-maint { background: #fff3cd; color: #856404; }

.avail-legend {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--gray-700);
    flex-wrap: wrap;
    gap: 0.25rem;
}

.avail-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.avail-ok { background: #d4edda; }
.avail-booked { background: #f8d7da; }
.avail-maint { background: #fff3cd; }

.spinner-sm {
    width: 24px; height: 24px;
    border: 3px solid var(--gray-300);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0.5rem auto;
}

/* Campo obligatorio */
.req {
    color: var(--danger-color);
    margin-left: 2px;
    font-weight: 700;
}

/* ===== PUBLIC FILTER BAR ===== */
.public-filter-bar {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.filter-section {
    margin-bottom: 1rem;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.6rem;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chip {
    padding: 0.28rem 0.8rem;
    border-radius: 999px;
    border: 1.5px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-700);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.5;
}

.chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.chip-active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.chip-active:hover {
    background: #e05a28;
    border-color: #e05a28;
    color: var(--white);
}

.filter-avail-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.btn-outline-sm {
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius);
    border: 1.5px solid var(--gray-400);
    background: transparent;
    color: var(--gray-600);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-outline-sm:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

/* ===== FILTRO DE DISTANCIA ===== */
.filter-distance-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.distance-slider {
    flex: 1;
    min-width: 160px;
    max-width: 320px;
    accent-color: var(--primary-color);
    height: 4px;
    cursor: pointer;
}

.distance-value {
    font-weight: 700;
    color: var(--primary-color);
    min-width: 60px;
    font-size: 0.95rem;
}

/* ===== CHAT / MENSAJERIA ===== */
.chat-section {
    margin-top: 1.25rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--white);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--secondary-color);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-status {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
}

.chat-messages {
    height: 220px;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--gray-100);
}

.chat-bubble {
    max-width: 75%;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-own {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 3px;
}

.chat-other {
    align-self: flex-start;
    background: var(--white);
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 3px;
}

.chat-bubble-time {
    font-size: 0.68rem;
    opacity: 0.7;
    margin-top: 3px;
    text-align: right;
}

.chat-other .chat-bubble-time {
    text-align: left;
}

.chat-input-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

.chat-input-row .form-control {
    flex: 1;
    margin: 0;
}

/* ===== INBOX ===== */
.inbox-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
    background: var(--white);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.inbox-row:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(255,107,53,0.1);
}

.inbox-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--secondary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.inbox-info {
    flex: 1;
    min-width: 0;
}

.inbox-name {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.inbox-unread-badge {
    background: var(--danger-color);
    color: white;
    border-radius: 999px;
    font-size: 0.7rem;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.inbox-machinery {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 500;
}

.inbox-preview {
    font-size: 0.83rem;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inbox-time {
    font-size: 0.75rem;
    color: var(--gray-500);
    flex-shrink: 0;
}

/* ── Tabs de modo (Maquinaria / Operarios) ────────────────────────────────── */
.main-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.main-tab {
    padding: 0.6rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-600);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -2px;
}

.main-tab:hover {
    color: var(--primary-color);
}

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

/* ── Tarjetas de operarios ────────────────────────────────────────────────── */
.operator-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem;
}

.operator-card-header {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.operator-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.operator-avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.7rem;
    flex-shrink: 0;
}

.operator-card-info {
    flex: 1;
    min-width: 0;
}

.operator-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 0.15rem;
    color: var(--gray-900);
}

.operator-location {
    font-size: 0.83rem;
    color: var(--gray-600);
    margin: 0;
}

.operator-exp {
    font-size: 0.82rem;
    color: var(--gray-600);
    margin: 0.1rem 0 0;
}

.operator-rate {
    text-align: right;
    flex-shrink: 0;
}

.operator-rate strong {
    font-size: 1.05rem;
    color: var(--gray-900);
}

.operator-rate span {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.operator-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-height: 1.6rem;
}

.skill-badge {
    font-size: 0.75rem;
}

.operator-desc {
    font-size: 0.85rem;
    color: var(--gray-700);
    margin: 0;
    line-height: 1.45;
}

.operator-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-200);
}

.operator-modal-top {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

/* ── Grid de checkboxes de habilidades ───────────────────────────────────── */
.skill-checkboxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.4rem;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.skill-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background 0.1s;
}

.skill-checkbox-label:hover {
    background: var(--gray-100);
}

/* ===== HAMBURGER MENU ===== */
.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 4px;
    z-index: 1001;
}

.navbar-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--dark-color);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Animación X cuando está abierto */
.navbar.open .navbar-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.navbar.open .navbar-toggle span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.navbar.open .navbar-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

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

    .card-grid {
        grid-template-columns: 1fr;
    }

    /* Mostrar botón hamburguesa */
    .navbar-toggle {
        display: flex;
    }

    /* El navbar necesita position:relative para el menú absoluto */
    .navbar {
        position: sticky;
    }

    /* Menús ocultos por defecto en móvil */
    .navbar-menus {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        border-top: 1px solid var(--gray-200);
        box-shadow: 0 8px 16px rgba(0,0,0,0.08);
        padding: 0.75rem 1rem 1rem;
        flex-direction: column;
        gap: 0;
        z-index: 999;
    }

    /* Mostrar menús cuando el nav tiene clase .open */
    .navbar.open .navbar-menus {
        display: flex;
    }

    /* Ajustes de los items del menú en móvil */
    .navbar-menu {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .navbar-menu li {
        width: 100%;
        border-bottom: 1px solid var(--gray-100);
    }

    .navbar-menu li:last-child {
        border-bottom: none;
        margin-top: 0.5rem;
    }

    .navbar-menu a {
        display: block;
        padding: 0.65rem 0.25rem;
        width: 100%;
    }

    .navbar-menu .btn {
        display: block;
        width: 100%;
        text-align: center;
        margin-top: 0;
    }
}

/* ===== BOOKING SUMMARY ===== */
.booking-summary-box {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 0.85rem 1rem;
}

.booking-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    border-top: 1px solid var(--gray-200);
    font-size: 0.9rem;
}

.booking-summary-row:first-child { border-top: none; }

.booking-summary-total {
    border-top: 2px solid var(--gray-300);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    font-size: 1rem;
    color: var(--gray-900);
}

/* ===== BARRA DE BÚSQUEDA DEL MAPA ===== */
.map-search-bar {
    margin-bottom: 0.75rem;
}

.map-search-input-wrap {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.map-search-input-wrap .form-control {
    flex: 1;
}

.map-search-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.4rem;
    margin-bottom: 0;
}

@media (max-width: 576px) {
    .map-search-input-wrap {
        flex-direction: column;
    }
    .map-search-input-wrap .form-control,
    .map-search-input-wrap .btn {
        width: 100%;
    }
}

/* ===== SECCIÓN TIPOS DE PERFIL ===== */
.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.profile-info-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-top: 4px solid transparent;
}

.profile-consumer {
    border-top-color: var(--secondary-color);
}

.profile-publisher {
    border-top-color: var(--primary-color);
}

.profile-info-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.profile-consumer .profile-info-icon {
    background: var(--secondary-color);
}

.profile-publisher .profile-info-icon {
    background: var(--primary-color);
}

.profile-info-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

.profile-info-subtitle {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin: 0;
}

.profile-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
}

.profile-info-list li {
    font-size: 0.88rem;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.4;
}

.profile-can::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: 700;
}

.profile-cannot::before {
    content: "✗";
    position: absolute;
    left: 0;
    color: var(--danger-color);
    font-weight: 700;
}

.profile-cannot {
    color: var(--gray-500);
}

@media (max-width: 768px) {
    .profile-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== TARJETAS DE DEMANDA DE MAQUINARIA ===== */
.request-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--secondary-color);
    transition: var(--transition);
}

.request-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}

.request-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}

.request-location {
    font-size: 0.88rem;
    color: var(--gray-600);
}

.request-description {
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.request-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
}

.request-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--gray-200);
}

.request-author {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.82rem;
}
/* ===== REVIEWS ===== */
.reviews-section {
    margin-top: 0.5rem;
}

.reviews-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.reviews-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.reviews-summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.reviews-avg {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-800);
}

.reviews-count {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* Stars display (read-only) */
.stars-display {
    display: inline-flex;
    gap: 1px;
}

.star {
    font-size: 1.1rem;
    line-height: 1;
}

.star-filled {
    color: #f59e0b;
}

.star-empty {
    color: var(--gray-300);
}

/* Stars input (interactive) — CSS-only flip trick */
.stars-input {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 2px;
    margin-bottom: 0.5rem;
}

.stars-input input[type="radio"] {
    display: none;
}

.stars-input label {
    font-size: 1.5rem;
    color: var(--gray-300);
    cursor: pointer;
    transition: color 0.15s;
}

.stars-input input[type="radio"]:checked ~ label,
.stars-input label:hover,
.stars-input label:hover ~ label {
    color: #f59e0b;
}

/* Review form */
.review-form-wrap {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.review-form-wrap h5 {
    margin: 0 0 0.6rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
}

.review-form-stars {
    margin-bottom: 0.5rem;
}

.review-comment {
    font-size: 0.875rem;
}

/* Review list */
.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.review-item {
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.review-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.review-author {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.review-date {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-left: auto;
}

.review-text {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin: 0;
    line-height: 1.5;
}

.reviews-empty,
.reviews-loading,
.reviews-error {
    font-size: 0.875rem;
    color: var(--gray-500);
    text-align: center;
    padding: 0.75rem 0;
    margin: 0;
}

.reviews-error {
    color: var(--danger);
}

/* ===== FEATURES SECTION ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

.feature-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.feature-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.feature-desc {
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin: 0;
}

/* ── Barra de entorno (solo visible en dev y pre) ── */
.env-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
}

body.env-dev .env-banner {
    display: flex;
    background: #f59e0b;
    color: #1c1917;
}

body.env-pre .env-banner {
    display: flex;
    background: #3b82f6;
    color: #ffffff;
}

body.env-dev,
body.env-pre {
    padding-top: 28px;
}

/* ── Subida de fotos ─────────────────────────────────────────────────────── */

.photo-upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--gray-50, #fafafa);
}
.photo-upload-area:hover {
    border-color: var(--primary);
    background: #f0f7ff;
}
.photo-upload-area-sm {
    padding: 0.75rem 1rem;
}

.photo-upload-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--gray-500);
    font-size: 0.9rem;
    pointer-events: none;
}
.photo-upload-icon {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 0.25rem;
}
.photo-upload-hint small {
    font-size: 0.78rem;
    color: var(--gray-400);
}

/* Grid de miniaturas */
.photo-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.photo-thumb-wrap {
    position: relative;
    width: 90px;
    height: 68px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--gray-200);
    flex-shrink: 0;
}
.photo-thumb-wrap:first-child {
    border-color: var(--primary);
}

.photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-thumb-del {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
}
.photo-thumb-del:hover {
    background: var(--danger, #dc3545);
}

.photo-cover-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(59,130,246,0.85);
    color: #fff;
    font-size: 0.65rem;
    text-align: center;
    padding: 1px 0;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ── Galería en modal de detalle ─────────────────────────────────────────── */

.detail-gallery {
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.gallery-main-wrap {
    position: relative;
    width: 100%;
    height: 260px;
    background: var(--gray-100);
}

.gallery-main {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.45);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.gallery-arrow:hover { background: rgba(0,0,0,0.7); }
.gallery-prev { left: 8px; }
.gallery-next { right: 8px; }

.gallery-counter {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 0.78rem;
    padding: 2px 7px;
    border-radius: 10px;
}

.gallery-thumbs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--gray-100);
    overflow-x: auto;
}

.gallery-thumb {
    width: 56px;
    height: 42px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    border: 2px solid transparent;
    flex-shrink: 0;
    transition: opacity 0.15s, border-color 0.15s;
}
.gallery-thumb.active,
.gallery-thumb:hover {
    opacity: 1;
    border-color: var(--primary);
}
