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

:root {
    /* Color Palette - Premium Solar Theme */
    --primary: #0f4c81;
    /* Deep Blue */
    --primary-light: #1e6fa3;
    --accent: #ff9f1c;
    /* Solar Orange */
    --accent-light: #ffbf69;
    --success: #2ec4b6;
    /* Teal/Success */
    --danger: #e71d36;
    --info: #011627;
    /* Navy */

    /* Backgrounds */
    --bg-main: #f0f4f8;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-sidebar: #011627;

    /* Text */
    --text-main: #1a1c1d;
    /* Mais escuro para contraste no branco */
    --text-muted: #535c5e;
    /* Mais escuro para melhor leitura */
    --text-light: #ffffff;

    /* Effects */
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-strong: 0 15px 35px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    overflow-x: hidden;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

h1,
h2,
h3,
h4,
h5,
.navbar-brand {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* --- Navigation --- */
.navbar-premium {
    background: rgba(1, 22, 39, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    transition: var(--transition);
}

.navbar-brand {
    font-size: 1.5rem;
    color: var(--text-light) !important;
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-brand i {
    color: var(--primary-light);
    filter: drop-shadow(0 0 5px rgba(15, 76, 129, 0.35));
}

.nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 800;
    /* Extra bold para ver melhor */
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-light) !important;
    background: var(--primary) !important;
    /* Azul no selecionado */
    opacity: 1;
}

/* --- Hero Section --- */
.hero-section {
    background: linear-gradient(135deg, #011627 0%, #0f4c81 100%);
    padding: 80px 0 120px;
    color: white;
    text-align: center;
    border-bottom-left-radius: 50% 20px;
    border-bottom-right-radius: 50% 20px;
    margin-bottom: -60px;
}

.content-hero {
    padding: 40px 0 110px;
    margin-bottom: -40px;
}

.content-hero .hero-title {
    font-size: 2.2rem;
}

.content-hero-body {
    margin-top: -30px;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #ffffff, var(--accent-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 700px;
    margin: 0 auto;
    font-weight: 400;
}

/* --- Cards & Grid --- */
.module-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    height: auto;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.module-card:hover {
    transform: none;
    box-shadow: var(--shadow-strong);
    background: white;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 0;
    background: var(--accent);
    transition: var(--transition);
}

.module-card:hover::before {
    height: 100%;
}

.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.5rem;
    transition: var(--transition);
}

.img-standard {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    object-fit: cover;
    display: block;
}

.img-standard-error {
    outline: 2px solid var(--danger);
    outline-offset: 2px;
}

.icon-blue {
    background: rgba(15, 76, 129, 0.1);
    color: var(--primary);
}

.icon-green {
    background: rgba(46, 196, 182, 0.1);
    color: var(--success);
}

.icon-red {
    background: rgba(231, 29, 54, 0.1);
    color: var(--danger);
}

.icon-yellow {
    background: rgba(255, 159, 28, 0.1);
    color: var(--accent);
}

.icon-info {
    background: rgba(1, 22, 39, 0.1);
    color: var(--info);
}

.icon-purple {
    background: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
}

.module-card:hover .icon-box {
    transform: scale(1.1) rotate(5deg);
}

/* --- Buttons --- */
.btn-premium {
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none !important;
}

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

.btn-primary-p:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

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

.btn-accent-p:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

.btn-outline-p {
    border: 2px solid #ddd;
    color: var(--text-main);
}

.btn-outline-p:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(15, 76, 129, 0.05);
}

/* --- Stats Cards --- */
.stats-container {
    padding-top: 40px;
}

.stats-card {
    background: white;
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    border-bottom: 4px solid #ddd;
    transition: var(--transition);
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stats-card:hover {
    transform: scale(1.05);
}

.stats-card h4 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: var(--primary);
    word-break: break-word;
    overflow-wrap: break-word;
    letter-spacing: -0.5px;
}

.stats-card p {
    color: var(--text-main);
    font-weight: 600;
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-card.blue {
    border-bottom-color: var(--primary);
}

.stats-card.green {
    border-bottom-color: var(--success);
}

.stats-card.navy {
    border-bottom-color: var(--info);
}

.stats-card.orange {
    border-bottom-color: var(--accent);
}

.stats-card.teal {
    border-bottom-color: #20c997;
}

/* --- Footer --- */
footer {
    background: var(--bg-sidebar);
    color: white;
    padding: 40px 0;
    margin-top: auto;
}

.footer-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 10px;
    display: block;
}

.footer-logo i {
    color: var(--accent);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInSlide 0.6s ease-out forwards;
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

/* --- Loading Overlay --- */
.loading-state {
    position: relative;
    min-height: 200px;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: inherit;
    transition: var(--transition);
}

.loader-content {
    text-align: center;
    animation: fadeInSlide 0.3s ease-out;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* --- Module Grid System --- */
.module-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(1, 1fr);
    margin-bottom: 3rem;
}

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

@media (min-width: 1024px) {
    .module-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1366px) {
    .module-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Development State --- */
.module-development {
    opacity: 0.65;
    filter: grayscale(0.2);
    cursor: default;
}

.module-development:hover {
    transform: none !important;
    box-shadow: var(--shadow-soft) !important;
}

.module-development .btn-premium {
    pointer-events: none;
    opacity: 0.7;
}

/* --- Custom Toast/Modal for Development --- */
.dev-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--info);
    color: white;
    padding: 1.2rem 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-strong);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    animation: toastFadeIn 0.3s ease-out forwards;
    border-left: 5px solid var(--accent);
}

.dev-toast i.fa-gear {
    color: var(--accent);
    animation: spin 3s linear infinite;
    font-size: 1.5rem;
}

.dev-toast .btn-close-toast {
    background: none;
    border: none;
    color: white;
    opacity: 0.7;
    cursor: pointer;
    font-size: 1.4rem;
    padding: 0;
    margin-left: 10px;
}

.dev-toast .btn-close-toast:hover {
    opacity: 1;
}

@keyframes toastFadeIn {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- Accessibility --- */
.module-card:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.app-body {
    background: var(--bg-main);
}

.screen {
    min-height: 100vh;
    width: 100%;
    display: none;
    background: var(--bg-main);
}

.screen-active {
    display: flex;
    animation: screenFade 0.35s ease;
}

.auth-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: var(--shadow-soft);
    text-align: center;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.4rem;
    margin-bottom: 16px;
    color: var(--primary);
}

.auth-logo i {
    color: var(--accent);
}

.auth-title {
    margin-bottom: 12px;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.auth-form .form-control {
    border-radius: 12px;
    padding: 12px 14px;
}

.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background: var(--bg-sidebar);
    color: var(--text-light);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand i {
    color: var(--primary-light);
}

.sidebar-user {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    padding-right: 6px;
    flex: 1;
    min-height: 0;
}

.sidebar-modules {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.sidebar-link {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 12px;
    border-radius: 10px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    transition: var(--transition);
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.sidebar-link.active {
    background: var(--primary);
    color: var(--text-light);
}

.sidebar-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sidebar-footer {
    flex-shrink: 0;
    padding-top: 4px;
}

.sidebar-footer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
    margin: 4px 0;
}

.content-area {
    margin-left: 270px;
    width: calc(100% - 270px);
    min-height: 100vh;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
}

.content-header {
    padding: 24px 32px 0;
}

.content-header h2 {
    margin: 0;
}

.content-title-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb-item.active {
    color: var(--text-main);
}

.content-section {
    padding: 24px 32px 32px;
}

.content-view {
    display: none;
}

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

.content-view-active.content-view-stretch {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-frame {
    width: 100%;
    min-height: calc(100vh - 110px);
    height: auto;
    border: 0;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}

@keyframes screenFade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   DASHBOARD ANALYTICS
   ========================================= */

.dash-analytics-header {
    background: linear-gradient(135deg, #011627 0%, #0f4c81 100%);
    color: white;
    border-radius: 0 0 16px 16px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
}

.dash-analytics-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(to right, #ffffff, #ffbf69);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dash-analytics-subtitle {
    font-size: 0.85rem;
    color: rgba(255,255,255,.7);
}

.dash-period-select {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    border-radius: 8px;
    font-size: 0.82rem;
    min-width: 150px;
}

.dash-period-select option {
    background: #011627;
    color: #fff;
}

.dash-refresh-btn {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    border-radius: 8px;
    font-size: 0.82rem;
    transition: var(--transition);
}

.dash-refresh-btn:hover {
    background: rgba(255,255,255,.2);
    color: #fff;
}

/* KPI Cards */
.dash-kpi-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0,0,0,.05);
    transition: var(--transition);
    min-height: 88px;
}

.dash-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-strong);
}

.dash-kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.dash-kpi-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dash-kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dash-mes-select {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(0,0,0,.18);
    font-size: 0.70rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 2px;
    cursor: pointer;
    outline: none;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: .4px;
    max-width: 90px;
}

.dash-mes-select:focus {
    border-bottom-color: #2ec4b6;
}

.dash-mes-select option {
    text-transform: uppercase;
    font-size: 12px;
}

.dash-kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.dash-kpi-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* Chart Cards */
.dash-chart-card {
    background: #fff;
    border-radius: 14px;
    padding: 18px 18px 12px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0,0,0,.05);
    transition: var(--transition);
}

.dash-chart-card:hover {
    box-shadow: var(--shadow-strong);
}

.dash-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.dash-chart-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* Ranking */
.dash-ranking {
    overflow-y: auto;
    max-height: 220px;
}

.dash-ranking-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.dash-ranking-pos {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-main);
    color: var(--text-muted);
}

.dash-ranking-pos.top1 { background: #ffc107; color: #fff; }
.dash-ranking-pos.top2 { background: #adb5bd; color: #fff; }
.dash-ranking-pos.top3 { background: #c8734a; color: #fff; }

.dash-ranking-name {
    font-size: 0.82rem;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-ranking-bar-wrap {
    flex: 1;
    background: #f0f4f8;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
}

.dash-ranking-bar {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #0f4c81, #2ec4b6);
    transition: width .6s ease;
}

.dash-ranking-val {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 60px;
    text-align: right;
}

/* O&M Alerts */
.dash-om-list {
    overflow-y: auto;
    max-height: 220px;
}

.dash-om-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    background: #fff8f8;
    border-left: 3px solid #e71d36;
    font-size: 0.82rem;
}

.dash-om-item.om-warn {
    background: #fffbe6;
    border-left-color: #ffc107;
}

.dash-om-item i {
    color: #e71d36;
    margin-top: 2px;
    flex-shrink: 0;
}

.dash-om-item.om-warn i {
    color: #ffc107;
}

.dash-om-title {
    font-weight: 600;
    color: var(--text-main);
    display: block;
}

.dash-om-sub {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.dash-badge-alert {
    background: #e71d36;
    color: #fff;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    margin-left: 6px;
}

.dash-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px 0;
    font-size: 0.85rem;
}

/* Responsive KPI shrink */
@media (max-width: 575px) {
    .dash-kpi-value { font-size: 1.1rem; }
    .dash-chart-card { padding: 14px 12px 10px; }
}
