@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Outfit:wght@300;400;700&display=swap');

:root {
    --primary: #FF8F1C;   /* Naranja Autónoma */
    --secondary: #B15533; /* Ocre Autónoma */
    --accent: #A39382;    /* Gris Autónoma */
    --bg-dark: #F8F9FA;   /* Fondo Claro */
    --bg-card: rgba(255, 255, 255, 0.95);
    --text-main: #2D3748; /* Texto Oscuro */
    --text-muted: #718096;
    --glass-border: rgba(255, 143, 28, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Dashboard Specific Body */
body.dashboard-body {
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
    justify-content: flex-start;
    padding: 0.5rem;
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--glass-shadow);
    padding: 1.5rem;
}

/* Form Container */
.form-container {
    width: 90%;
    max-width: 600px;
    padding: 2.5rem;
    margin: 2rem 0;
    animation: slideUp 0.8s ease-out;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

p.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Question Group */
.question-group {
    margin-bottom: 2rem;
    transition: transform 0.3s ease;
}

.question-group:hover {
    transform: translateX(5px);
}

.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: block;
    color: var(--primary);
}

/* Options */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.option-item {
    position: relative;
    padding: 1.2rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Custom Checkbox Style for Multi-select feel */
.option-item input[type="radio"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    position: relative;
    cursor: pointer;
}

.option-item input[type="radio"]:checked {
    border-color: var(--primary);
}

.option-item input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.option-item.selected {
    background: rgba(0, 242, 254, 0.1);
    border-color: var(--primary);
}

/* Text Input Styling */
.other-input {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.8rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    outline: none;
    transition: all 0.3s ease;
}

.other-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(240, 147, 251, 0.2);
}

/* Dashboard Logic */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
}

@media (min-width: 992px) {
    .dashboard-layout {
        display: grid;
        grid-template-columns: 280px 1fr;
        height: calc(100vh - 1rem);
    }
}

.sidebar-filters {
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
    position: relative;
    z-index: 10;
}

/* Custom Scrollbar for Sidebar */
.sidebar-filters::-webkit-scrollbar {
    width: 4px;
}
.sidebar-filters::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

/* Custom Select Styling */
.filter-group {
    margin-bottom: 0.8rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
}

.custom-select-container {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.custom-select-trigger:hover {
    border-color: var(--primary);
}

.custom-select-container.active .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 143, 28, 0.1);
}

.custom-options {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    z-index: 9999; /* Máximo nivel para sobreponerse a todo */
    display: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    overflow: hidden;
}

.custom-select-container.active {
    z-index: 10000; /* Asegura que el contenedor activo esté sobre los demás */
}

.custom-select-container.active .custom-options {
    display: block;
}

.custom-option {
    padding: 0.7rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-dark);
}

.custom-option:hover {
    background: #f8fafc;
    color: var(--primary);
}

.custom-option.selected {
    background: #fff7ed;
    color: var(--primary);
    font-weight: 600;
}

.custom-options.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.option {
    padding: 0.6rem 1rem;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f7fafc;
    color: #4a5568;
}

.option:last-child { border: none; }

.option:hover {
    background: #fffaf0;
    color: var(--primary);
}

.option.selected {
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
}

.select-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.custom-select.active .select-arrow {
    transform: rotate(180deg);
}

.slicer { display: none; } /* Hide old slicer elements */

.slicer-item {
    padding: 0.5rem 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slicer-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

.slicer-item.active {
    background: rgba(0, 242, 254, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.slicer-item.active::after {
    content: '●';
    font-size: 0.6rem;
}

/* Main Content Grid */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

@media (min-width: 768px) {
    .main-content {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .main-content {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto 1fr 1fr;
        height: 100%;
    }
}

.summary-banner {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--primary);
    color: white;
    padding: 0.5rem; /* Reduced height */
    border-radius: 10px;
}

.summary-banner .stat-item .lbl {
    color: rgba(255, 255, 255, 0.9);
}

.summary-banner .stat-item .val {
    color: white;
    font-size: 1.5rem; /* Smaller KPIs */
    font-weight: 800;
    line-height: 1;
}

.stat-item .lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chart-card {
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

@media (min-width: 1200px) {
    .chart-card {
        min-height: 0;
    }
}

.chart-card h3 {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    text-align: center;
}

.chart-container {
    flex: 1;
    position: relative;
    min-height: 0;
}

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.btn-submit {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Media Queries */
@media (max-width: 991px) {
    .sidebar-filters {
        height: auto;
        padding: 1rem;
    }
}

/* Insights Card */
.insights-card {
    display: flex;
    flex-direction: column;
    background: white;
    height: 100%;
    overflow: hidden;
}

.insights-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribución perfecta */
    gap: 2px;
    padding: 2px 0;
    overflow: hidden; /* Elimina scroll vertical y horizontal */
}

.insight-item {
    flex: 1; /* Crece para llenar el espacio */
    display: flex;
    align-items: center; /* Centrado vertical para equilibrio */
    gap: 10px;
    padding: 4px 12px;
    background: #FFF9F3;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    transition: all 0.2s ease;
    margin: 2px 0;
    min-height: 0;
}

.insight-item:hover {
    transform: translateX(4px);
    background: #FFF1E5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.insight-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.insight-title {
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.3px;
}

.insight-icon {
    font-size: 1.3rem;
    padding-top: 2px;
    filter: drop-shadow(0 2px 4px rgba(255,143,28,0.2));
}

.insight-text {
    font-size: 0.68rem;
    color: var(--text-dark);
    line-height: 1.1;
    font-weight: 600;
    white-space: normal; /* Asegura que el texto fluya sin causar scroll horizontal */
    overflow: hidden;
}

/* Scrollbar para insights */
.insights-content::-webkit-scrollbar {
    width: 4px;
}

.insights-content::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

/* Data Table Styles */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.5);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.data-table th {
    background: var(--primary);
    color: white;
    padding: 1rem;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.data-table tr:hover {
    background: rgba(255, 143, 28, 0.05);
}

.btn-view {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.2s;
}

.btn-view:hover {
    background: var(--secondary);
    transform: translateY(-1px);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20000;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    border-radius: 12px;
    padding: 2.5rem;
    position: relative;
    overflow-y: auto;
    animation: slideUp 0.4s ease-out;
}

.modal-header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 1rem;
}

.modal-header h2 {
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    margin: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-row {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.detail-row.full-width {
    grid-column: span 2;
}

.detail-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 800;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 600;
    line-height: 1.3;
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.close-modal:hover {
    color: var(--primary);
}

@media (max-width: 600px) {
    .detail-grid { grid-template-columns: 1fr; }
    .detail-row.full-width { grid-column: span 1; }
}
