/* ============================================
   SEIG ECOFOREST - Web Version CSS
   ============================================ */

:root {
    --primary: #FF6600;
    --primary-hover: #E65100;
    --secondary: #2C3E50;
    --bg: #EAECEE;
    --white: #FFFFFF;
    --vanilla: #FFF9C4;
    --red: #C0392B;
    --green: #27AE60;
    --text: #2C3E50;
    --blue: #3498DB;
    --dark-blue: #1A5276;
    --alert: #E74C3C;
    --warning: #F39C12;
    --muted: #7F8C8D;
    --border: #D5D8DC;
    --card-bg: #F8F9F9;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ============ HEADER ============ */
.main-header {
    background: var(--white);
    border-bottom: 3px solid var(--primary);
    padding: 10px 40px;
}
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1600px;
    margin: 0 auto;
}
.logo-img { height: 70px; object-fit: contain; }
.logo-img-center { height: 90px; object-fit: contain; }
.header-title { color: var(--primary); font-size: 28px; }
.header-clock { text-align: right; }
.clock-time { font-size: 32px; font-weight: bold; color: var(--dark-blue); font-family: 'Roboto', monospace; }
.clock-date { font-size: 14px; font-weight: bold; color: var(--dark-blue); }

/* ============ NAV ============ */
.main-nav {
    background: var(--secondary);
    padding: 10px 0;
}
.nav-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 24px;
    color: white;
    text-decoration: none;
    border: 2px solid white;
    border-radius: 10px;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.2s;
    position: relative;
}
.nav-btn:hover, .nav-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}
.nav-btn-logout {
    border-color: var(--red);
}
.nav-btn-logout:hover {
    background: var(--red);
    border-color: var(--red);
}
.nav-btn-mto { position: relative; }
.nav-btn-pend { position: relative; }
.badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--alert);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* ============ FLASH MESSAGES ============ */
.flash-container { max-width: 1400px; margin: 10px auto; padding: 0 30px; }
.flash-msg {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.flash-success { background: #D5F5E3; color: #1E8449; border-left: 4px solid var(--green); }
.flash-error { background: #FADBD8; color: #922B21; border-left: 4px solid var(--red); }
.flash-close { background: none; border: none; font-size: 20px; cursor: pointer; color: inherit; }

/* ============ MAIN CONTENT ============ */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 30px;
    min-height: calc(100vh - 250px);
}

/* ============ FOOTER ============ */
.main-footer {
    text-align: center;
    padding: 15px;
    color: var(--muted);
    font-size: 12px;
    background: var(--white);
    border-top: 1px solid var(--border);
}

/* ============ LOGIN ============ */
.login-body {
    background: #E8E8E8;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: white;
    border-radius: 20px;
    padding: 30px 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 2px solid var(--border);
}
.login-logo { text-align: center; padding: 10px 0; }
.login-logo img { max-width: 220px; height: auto; }
.login-divider { height: 3px; background: var(--primary); margin: 10px 0; }
.login-title { text-align: center; color: var(--secondary); font-size: 18px; margin: 15px 0 25px; }
.login-input { background: #FFF9E6 !important; }
.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 14px;
    margin-top: 10px;
}
.login-footer { text-align: center; color: var(--border); font-size: 10px; margin-top: 25px; }

/* ============ TITLES ============ */
.page-title { color: var(--primary); font-size: 24px; font-weight: bold; margin-bottom: 20px; }
.page-subtitle { color: var(--text); font-size: 16px; margin-bottom: 15px; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: #95A5A6; color: white; }
.btn-success { background: var(--green); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-dark { background: var(--secondary); color: white; }
.btn-info { background: #2980B9; color: white; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-estado-finalizar { background: #27AE60; color: white; }
.btn-estado-finalizar:hover { background: #219A52; }
.btn-estado-reabrir { background: #E67E22; color: white; }
.btn-estado-reabrir:hover { background: #CF6D17; }

.btn-icon {
    width: 36px; height: 36px; border-radius: 6px; border: none;
    font-size: 14px; cursor: pointer; display: inline-flex;
    align-items: center; justify-content: center; text-decoration: none;
    transition: all 0.2s;
}
.btn-primary-icon { background: var(--primary); color: white; }
.btn-dark-icon { background: var(--secondary); color: white; }
.btn-danger-icon { background: var(--red); color: white; }
.btn-icon:hover { opacity: 0.85; transform: scale(1.05); }

.btn-action {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    width: 70px; height: 56px; border-radius: 8px; border: none;
    font-size: 14px; cursor: pointer; text-decoration: none;
    transition: all 0.2s; gap: 2px;
}
.btn-action:hover { opacity: 0.85; transform: scale(1.05); }
.btn-action-icon { font-size: 18px; line-height: 1; }
.btn-action-text { font-size: 10px; font-weight: bold; color: white; line-height: 1; }
.btn-success-action { background: var(--green); color: white; }
.btn-info-action { background: #2980B9; color: white; }
.btn-finalizar-action { background: #27AE60; color: white; }
.btn-reabrir-action { background: #E67E22; color: white; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 12px; }
.form-label { display: block; font-size: 11px; font-weight: bold; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; }
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: white;
}
.form-input:focus { border-color: var(--primary); outline: none; }
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--vanilla);
    resize: none;
    height: 80px;
    overflow-y: auto;
}
.form-textarea:focus { border-color: var(--primary); outline: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 15px; }
.form-grid { display: grid; gap: 10px 15px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

select.form-input { cursor: pointer; }

.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: bold; cursor: pointer; }
.checkbox-label input { width: 18px; height: 18px; }

.radio-group { display: flex; gap: 15px; margin-top: 8px; }
.radio-label { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 18px; border: 2px solid var(--border); border-radius: 8px; transition: all 0.2s; }
.radio-label:has(input:checked) { border-color: var(--primary); background: #FFF3E8; }
.radio-label input[type="radio"] { width: 18px; height: 18px; accent-color: var(--primary); }
.radio-text { font-weight: bold; font-size: 14px; }
.radio-pendiente { color: var(--warning); }
.radio-finalizado { color: var(--green); }

/* ============ CARDS & SECTIONS ============ */
.section-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}
.section-title { color: var(--primary); font-size: 14px; font-weight: bold; margin-bottom: 15px; }
.section-info-cliente { background: #F3E5F5; }

/* ============ FILTER CARD ============ */
.filter-card {
    background: var(--white);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}
.filter-row { margin-bottom: 10px; }
.search-global { display: flex; align-items: center; gap: 10px; }
.search-icon { font-size: 16px; }
.search-input { flex: 1; }
.filter-grid { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filter-item { flex: 1; min-width: 120px; }
.filter-label { display: block; font-size: 10px; font-weight: bold; color: var(--muted); margin-bottom: 3px; }
.filter-input { width: 100%; }
.filter-buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }

/* ============ DROPDOWN ============ */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
    display: none; position: absolute; background: white; min-width: 150px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-radius: 8px; z-index: 100;
    right: 0; top: 100%;
}
.dropdown-content a { display: block; padding: 10px 16px; color: var(--text); text-decoration: none; font-size: 13px; }
.dropdown-content a:hover { background: var(--card-bg); }
.dropdown:hover .dropdown-content { display: block; }

/* ============ TABLE HEADER ============ */
.table-header {
    display: grid;
    background: var(--secondary);
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 5px;
    color: white;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
}
/* Clientes grid */
.table-header:has(.th-cliente) { grid-template-columns: 1.5fr 1fr 1.5fr 280px; }
.table-header:has(.th-mto-cliente) { grid-template-columns: 1.2fr 1.2fr 1fr 320px; }

.th-col:hover { color: var(--primary); }

/* ============ RESULTS LIST ============ */
.results-list { max-height: calc(100vh - 420px); overflow-y: auto; }
.result-card {
    display: grid;
    background: var(--white);
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 4px;
    align-items: center;
    cursor: pointer;
    transition: box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.result-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.12); }
.result-card.card-en-proceso { background: #FFF3E0; border-left: 4px solid #E67E22; }
.result-card.card-finalizado { background: #E8F8F5; border-left: 4px solid #27AE60; }

/* Clientes result grid */
.result-card:has(.rc-cliente) { grid-template-columns: 1.5fr 1fr 1.5fr 280px; }
.result-card:has(.rc-mto-cliente) { grid-template-columns: 1.2fr 1.2fr 1fr 320px; }

.rc-col { padding: 5px 10px; }
.rc-acciones, .rc-mto-acciones { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }

.no-results { text-align: center; padding: 40px; color: var(--muted); font-size: 16px; }
.loading { text-align: center; padding: 40px; color: var(--muted); }

/* ============ DASHBOARD ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--white);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-title { font-size: 15px; font-weight: bold; color: var(--secondary); margin-bottom: 5px; }
.stat-value { font-size: 48px; font-weight: bold; }
.stat-subtitle { font-size: 14px; font-weight: bold; color: var(--text); }

.dashboard-panels {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}
.panel {
    background: var(--white);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow);
}
.panel-title { font-size: 13px; font-weight: bold; color: var(--secondary); margin-bottom: 15px; text-align: center; }
.panel-scroll { max-height: 350px; overflow-y: auto; }

/* Técnico bars */
.tecnico-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 0 10px; }
.tecnico-bar-name { width: 100px; font-size: 13px; font-weight: 500; flex-shrink: 0; }
.tecnico-bar-container { flex: 1; height: 25px; background: #E8E8E8; border-radius: 5px; overflow: hidden; }
.tecnico-bar-fill { height: 100%; border-radius: 5px; min-width: 5%; transition: width 0.5s; }
.tecnico-bar-value { width: 40px; text-align: right; font-weight: bold; font-size: 14px; flex-shrink: 0; }

/* Próximos */
.proximo-item { display: flex; align-items: stretch; margin-bottom: 4px; background: var(--card-bg); border-radius: 6px; min-height: 50px; }
.proximo-color-bar { width: 6px; border-radius: 3px 0 0 3px; flex-shrink: 0; }
.proximo-info { padding: 6px 10px; flex: 1; }
.proximo-cliente { font-size: 13px; font-weight: bold; color: var(--text); }
.proximo-detalle { font-size: 11px; font-weight: bold; }

/* Alertas */
.alerta-item { border-radius: 8px; padding: 10px 12px; margin-bottom: 5px; }
.alerta-titulo { font-size: 12px; font-weight: bold; margin-bottom: 4px; }
.alerta-detalle { font-size: 11px; color: var(--muted); padding-left: 10px; }
.alerta-extra { font-weight: bold; color: #95A5A6; }

/* ============ FICHA CLIENTE ============ */
.ficha-container { display: grid; grid-template-columns: 2fr 1fr; gap: 15px; }
.ficha-datos { }
.ficha-historial { }
.historial-scroll { max-height: 500px; overflow-y: auto; }
.historial-item { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; background: var(--card-bg); border-radius: 4px; min-height: 36px; padding-right: 5px; }
.historial-bar { width: 3px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.historial-info { flex: 1; padding: 4px 0; }
.historial-estado { font-size: 11px; font-weight: bold; }
.historial-cpu-change {
    font-size: 10px; font-weight: bold; color: #E67E22;
    background: #FFF3E0; border-radius: 4px; padding: 2px 6px; margin-top: 2px;
    display: inline-block;
}

/* ============ MANTENIMIENTOS ============ */
.tab-bar { display: flex; gap: 5px; margin-bottom: 15px; }
.tab-btn {
    padding: 10px 24px; border: 2px solid var(--secondary); background: white;
    border-radius: 8px 8px 0 0; font-size: 13px; font-weight: bold;
    cursor: pointer; color: var(--secondary); transition: all 0.2s;
}
.tab-btn.active { background: var(--secondary); color: white; }

.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }

/* ============ AGENDAR ============ */
.agendar-grid { display: grid; grid-template-columns: 2fr 3fr; gap: 15px; }
.agendar-left { }
.agendar-right { }

.pendiente-agendar-row {
    display: flex; align-items: center; justify-content: space-between; gap: 15px;
    padding: 12px 15px;
}

.switch-container {
    display: flex; align-items: center; justify-content: center; gap: 15px;
    padding: 15px; margin-bottom: 15px;
}
.switch-label { font-size: 13px; font-weight: bold; color: var(--text); }
.switch { position: relative; display: inline-block; width: 52px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc; border-radius: 28px; transition: 0.3s;
}
.switch-slider:before {
    content: ""; position: absolute; height: 22px; width: 22px;
    left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s;
}
.switch input:checked + .switch-slider { background: var(--green); }
.switch input:checked + .switch-slider:before { transform: translateX(24px); }

.tecnicos-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.tecnico-btn {
    flex: 1; min-width: 120px; padding: 10px 16px; border: 2px solid var(--tec-color);
    background: transparent; color: var(--tec-color); border-radius: 8px;
    font-size: 13px; font-weight: bold; cursor: pointer; transition: all 0.2s;
}
.tecnico-btn:hover, .tecnico-btn.selected {
    background: var(--tec-color); color: white; border-width: 3px;
}

.aviso-duplicidad {
    background: #FDECEA; border: 2px solid var(--alert); border-radius: 8px;
    padding: 12px 16px; margin-top: 15px; color: var(--alert); font-size: 13px;
}

.info-dia {
    background: var(--card-bg); border-radius: 8px; padding: 15px;
    margin-top: 10px; font-size: 13px; font-weight: bold; min-height: 60px;
}

.calendar-legend {
    display: flex; gap: 15px; flex-wrap: wrap; padding: 8px 10px;
    background: var(--card-bg); border-radius: 8px; margin-bottom: 10px;
}
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.legend-dot { width: 16px; height: 16px; border-radius: 3px; display: inline-block; }

/* ============ TÉCNICOS ============ */
.tecnicos-container { max-width: 900px; margin: 0 auto; }
.add-tecnico-form { display: flex; gap: 10px; justify-content: center; margin-bottom: 15px; flex-wrap: wrap; }
.tecnicos-list { margin-top: 20px; }
.tecnico-card {
    display: flex; justify-content: space-between; align-items: center;
    background: white; border-radius: 8px; padding: 12px 15px;
    margin-bottom: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.tecnico-info { display: flex; align-items: center; gap: 12px; }
.tecnico-dot { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; }
.tecnico-nombre { font-size: 14px; font-weight: bold; color: var(--text); }
.tecnico-email { font-size: 12px; color: #95A5A6; }
.tecnico-email.has-email { color: var(--primary); }
.tecnico-actions { display: flex; gap: 6px; }

/* ============ UTILIDADES ============ */
.utilidades-container { max-width: 1000px; margin: 0 auto; }
.informes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.informe-card {
    background: var(--card-bg); border-radius: 10px; padding: 20px;
    display: flex; flex-direction: column; gap: 10px;
}
.informe-card h4 { text-align: center; color: var(--secondary); font-size: 14px; margin-bottom: 5px; }

/* ============ MODAL ============ */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); display: flex; align-items: center;
    justify-content: center; z-index: 1000;
}
.modal-content {
    background: white; border-radius: 15px; padding: 30px;
    max-width: 500px; width: 90%; box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.modal-content h3 { color: var(--primary); margin-bottom: 15px; font-size: 18px; }

/* ============ UTILITY CLASSES ============ */
.text-primary { color: var(--primary); font-weight: bold; }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }

/* ============ FULLCALENDAR OVERRIDES ============ */
#fullcalendar, #mini-calendar { background: white; border-radius: 8px; padding: 10px; }
.fc .fc-toolbar-title { font-size: 18px !important; color: var(--secondary); }
.fc .fc-button-primary {
    background: var(--secondary) !important; border-color: var(--secondary) !important;
}
.fc .fc-button-primary:hover {
    background: var(--primary) !important; border-color: var(--primary) !important;
}
.fc .fc-button-active {
    background: var(--primary) !important; border-color: var(--primary) !important;
}
.fc .fc-daygrid-day-number { color: var(--text); font-weight: 500; }
.fc .fc-day-today { background: rgba(44, 62, 80, 0.18) !important; }
.fc .fc-day-today .fc-daygrid-day-number { color: #2C3E50 !important; font-weight: 900 !important; font-size: 1.1em; }
.fc .fc-day-selected { background: #FF6600 !important; }
.fc .fc-day-selected .fc-daygrid-day-number { color: #FFFFFF !important; font-weight: 900 !important; font-size: 1.2em; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-panels { grid-template-columns: 1fr; }
    .ficha-container { grid-template-columns: 1fr; }
    .agendar-grid { grid-template-columns: 1fr; }
    .informes-grid { grid-template-columns: 1fr; }
    .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .col-span-3 { grid-column: span 2; }
    .result-card:has(.rc-cliente),
    .table-header:has(.th-cliente) { grid-template-columns: 1fr 1fr 1fr auto; }
    .result-card:has(.rc-mto-cliente),
    .table-header:has(.th-mto-cliente) { grid-template-columns: 1fr 1fr 1fr auto; }
}

@media (max-width: 768px) {
    .main-content { padding: 10px 15px; }
    .header-content { padding: 5px 15px; }
    .header-logo-left { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .result-card, .table-header { font-size: 12px; }
    .nav-btn { padding: 8px 14px; font-size: 11px; }
    .filter-grid { flex-direction: column; }
}
