:root {
    --bg-color: #111827;
    --sidebar-bg: #1F2937;
    --card-color: #1F2937;
    --primary-accent: #38BDF8;
    --secondary-accent: #F472B6;
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --border-color: #374151;
    --success-color: #34D399;
    --warning-color: #FBBF24;
    --danger-color: #F87171;
    --shadow-color: rgba(56, 189, 248, 0.1);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.dashboard-header {
    background-color: var(--sidebar-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-accent);
}

.logo h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 1px;
}

#summary-btn {
    background: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
    color: white;
    border: none;
    padding: 0.65rem 1.3rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#summary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#summary-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.dashboard-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sectors-sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    padding: 1.5rem;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.sectors-sidebar h2 {
    margin-top: 0;
    font-weight: 600;
    padding-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#sectors-nav button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.9rem 1rem;
    text-align: left;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    position: relative;
    font-weight: 500;
}

#sectors-nav button:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: translateX(5px);
}

#sectors-nav button.active {
    background-color: var(--primary-accent);
    color: white;
    font-weight: 600;
    box-shadow: 0 0 15px var(--shadow-color);
}

.content-area {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    background-color: var(--card-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow-color);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.metric-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-icon {
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-style: italic;
    font-family: 'Times New Roman', serif;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.info-icon:hover {
    background-color: var(--primary-accent);
    color: white;
}

.info-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%);
    width: 240px;
    background-color: #2d3748;
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    font-style: normal;
    line-height: 1.5;
    text-align: left;
    font-weight: 400;
    z-index: 100;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    opacity: 1;
    visibility: visible;
    animation: tooltip-fade-in 0.3s ease;
}

/* Tooltip alignment fix for the last two cards */
.metric-card:nth-child(n+3) .info-icon:hover::after {
    left: auto;
    right: 0;
    transform: translateX(0);
}


@keyframes tooltip-fade-in {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.metric-card:nth-child(n+3) .info-icon:hover::after {
    from { opacity: 0; transform: translateX(0) translateY(10px); }
    to { opacity: 1; transform: translateX(0) translateY(0); }
}

.metric-card p {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

p.positive { color: var(--success-color); }
p.negative { color: var(--danger-color); }


.chart-container {
    background-color: var(--card-color);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.chart-container h3 {
    margin: 0 0 1.5rem 0;
    text-align: left;
    font-weight: 600;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.chart-wrapper {
    position: relative;
    flex-grow: 1;
    min-height: 300px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #1F2937;
    margin: auto;
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 650px;
    border-radius: 16px;
    position: relative;
    animation: modal-fade-in 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes modal-fade-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.close-button {
    color: var(--text-secondary);
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.close-button:hover,
.close-button:focus {
    color: var(--text-primary);
    transform: rotate(90deg);
}

#summary-content h2 {
    font-size: 1.5rem;
    color: var(--primary-accent);
}

#summary-text {
    line-height: 1.7;
    color: var(--text-secondary);
}

.disclaimer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    opacity: 0.7;
}

/* Loader Animation */
.loader {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    position: relative;
    animation: rotate 1s linear infinite;
    margin: 2rem auto 1rem auto;
}
.loader::before , .loader::after {
    content: "";
    box-sizing: border-box;
    position: absolute;
    inset: 0px;
    border-radius: 50%;
    border: 5px solid #FFF;
    animation: prixClipFix 2s linear infinite ;
}
.loader::after{
    border-color: var(--primary-accent);
    animation: prixClipFix 2s linear infinite , rotate 0.5s linear infinite reverse;
    inset: 6px;
}

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

@keyframes prixClipFix {
    0%   {clip-path:polygon(50% 50%,0 0,0 0,0 0,0 0,0 0)}
    25%  {clip-path:polygon(50% 50%,0 0,100% 0,100% 0,100% 0,100% 0)}
    50%  {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,100% 100%,100% 100%)}
    75%  {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 100%)}
    100% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 0)}
}