/* ===================================
   PALMARES OPEN MALL - DASHBOARD CSS
   Professional Design - No Emojis
   =================================== */

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

:root {
    /* Primary Colors */
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;

    /* Sentiment Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Background */
    --bg-body: #f9fafb;
    --bg-card: #ffffff;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #6b7280;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transitions */
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =========================
   LOGIN SCREEN
   ========================= */

#login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #ffffff;
    padding: 20px;
}

.login-box {
    background: var(--bg-card);
    padding: 48px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
}

.login-logo {
    display: block;
    margin: 0 auto 24px auto;
    height: 80px;
    width: auto;
    object-fit: contain;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    color: var(--primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-header .subtitle {
    font-size: 15px;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: var(--transition);
    background: var(--bg-card);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.btn-login {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-login:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-login:active {
    transform: translateY(0);
}

.error-message {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--danger-light);
    color: var(--danger);
    border-radius: var(--radius-md);
    font-size: 14px;
    border-left: 4px solid var(--danger);
}

.login-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.login-footer .small {
    font-size: 13px;
    margin-top: 4px;
    color: var(--gray-400);
}

/* =========================
   DASHBOARD LAYOUT
   ========================= */

.dashboard-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.logo-section h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.user-info strong {
    color: var(--text-primary);
}

.btn-logout {
    padding: 8px 16px;
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--gray-200);
}

/* Navigation Tabs */
.dashboard-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
}

.nav-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    color: var(--text-primary);
    background: var(--gray-50);
}

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

/* Main Content */
.dashboard-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
    min-height: calc(100vh - 200px);
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 15px;
}

/* Tabs */
.tab-content {
    display: none;
}

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

/* Section Titles */
.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

/* =========================
   METRICS SECTION
   ========================= */

.metrics-section {
    margin-bottom: 32px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.metric-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    display: flex;
    gap: 16px;
    align-items: center;
    transition: var(--transition);
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon svg {
    width: 28px;
    height: 28px;
}

.metric-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.metric-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.metric-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.metric-icon.red {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.metric-info {
    flex: 1;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.metric-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =========================
   CHARTS SECTION
   ========================= */

.charts-section {
    margin-bottom: 32px;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.chart-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.chart-card-small {
    height: 650px;
}

.chart-card-large {
    height: 650px;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* =========================
   TABLES
   ========================= */

.ranking-section,
.details-section {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
}

.table-wrapper {
    overflow-x: auto;
}

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

thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: var(--transition);
}

tbody tr:hover {
    background: var(--gray-50);
}

td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-excelente {
    background: var(--success-light);
    color: #065f46;
}

.status-bueno {
    background: var(--info-light);
    color: #1e40af;
}

.status-regular {
    background: var(--warning-light);
    color: #92400e;
}

.status-malo {
    background: var(--danger-light);
    color: #991b1b;
}

.trend-positive {
    color: var(--success);
    font-weight: 600;
}

.trend-negative {
    color: var(--danger);
    font-weight: 600;
}

/* =========================
   INSIGHTS SECTION
   ========================= */

.insights-section {
    margin-bottom: 32px;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.insight-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.insight-card.positive {
    border-left: 4px solid var(--success);
}

.insight-card.negative {
    border-left: 4px solid var(--danger);
}

.insight-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.insight-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.aspects-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aspect-item {
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aspect-item strong {
    color: var(--text-primary);
}

.aspect-item .count {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

/* Recommendations */
.recommendations-section {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.recommendations-grid {
    display: grid;
    gap: 16px;
}

.recommendation-card {
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
}

.recommendation-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.recommendation-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* =========================
   FOOTER
   ========================= */

.dashboard-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--gray-200);
    padding: 24px;
    margin-top: 48px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.footer-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.footer-meta {
    font-size: 13px;
    color: var(--gray-400);
}

.footer-right {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.powered-by {
    font-size: 12px;
    color: var(--gray-400);
    margin: 0;
}

.footer-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.login-powered {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.powered-text {
    font-size: 12px;
    color: var(--gray-400);
    margin: 0;
}

.login-zonerank-logo {
    height: 35px;
    width: auto;
    object-fit: contain;
}

/* =========================
   RESPONSIVE
   ========================= */

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

@media (max-width: 768px) {
    .login-box {
        padding: 32px;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
    }

    .nav-content {
        overflow-x: auto;
    }

    .dashboard-main {
        padding: 20px 16px;
    }

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

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

    table {
        font-size: 13px;
    }

    th, td {
        padding: 10px 12px;
    }
}

/* =========================
   UTILITIES
   ========================= */

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.font-bold {
    font-weight: 600 !important;
}

/* =========================
   MAPA
   ========================= */

.map-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.map-legend {
    display: flex;
    gap: 24px;
    margin: 16px 0 24px 0;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.legend-dot.excelente {
    background-color: #10b981;
}

.legend-dot.bueno {
    background-color: #3b82f6;
}

.legend-dot.regular {
    background-color: #f59e0b;
}

.legend-dot.malo {
    background-color: #ef4444;
}

.map-container {
    height: 600px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

/* =========================
   VISTA INDIVIDUAL LOCAL
   ========================= */

.local-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.local-detail {
    margin-top: 24px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 16px;
}

.local-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.local-stat {
    background: var(--gray-50);
    padding: 20px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
}

.local-stat.positive {
    border-left-color: var(--success);
}

.local-stat.negative {
    border-left-color: var(--danger);
}

.local-stat.neutral {
    border-left-color: var(--warning);
}

.local-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.local-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.local-insights {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.local-insight-box {
    background: var(--gray-50);
    padding: 24px;
    border-radius: var(--radius-md);
}

.local-insight-box.positive {
    border-top: 3px solid var(--success);
}

.local-insight-box.negative {
    border-top: 3px solid var(--danger);
}

.local-insight-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.local-aspect-list {
    list-style: none;
}

.local-aspect-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
    color: var(--text-secondary);
}

.local-aspect-list li:last-child {
    border-bottom: none;
}

.reviews-section {
    margin-top: 32px;
}

.reviews-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.review-card {
    background: var(--bg-card);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.review-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.review-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.review-stars {
    color: #f59e0b;
    font-size: 14px;
}

.review-sentiment {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.review-sentiment.positivo {
    background: var(--success-light);
    color: var(--success);
}

.review-sentiment.negativo {
    background: var(--danger-light);
    color: var(--danger);
}

.review-sentiment.neutral {
    background: var(--warning-light);
    color: var(--warning);
}

.review-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.review-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.review-author {
    font-weight: 500;
}

.review-date {
    font-size: 12px;
}

/* Leaflet Popup Custom Styles */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md);
    padding: 4px;
}

.popup-local {
    padding: 8px;
}

.popup-local-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.popup-local-stats {
    font-size: 13px;
    color: var(--text-secondary);
}

.popup-local-stats div {
    margin: 4px 0;
}
