:root {
    --primary-color: #0e2e60;
    --secondary-color: #00963a;
    --background-color: #f1f5f9;
    --text-color: #1e293b;
    --white: #ffffff;
    --glass-background: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --header-height: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    overflow-x: hidden;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
    width: 100vw;
    transition: all 0.5s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Login Screen */
#login-screen {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1c4a8f 100%);
    justify-content: center;
    align-items: center;
}

.login-card {
    background: var(--glass-background);
    backdrop-filter: blur(10px);
    width: 400px;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    animation: fadeInUp 0.8s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.logo-container h1 {
    color: var(--primary-color);
    margin: 10px 0 5px;
    font-weight: 700;
}

.logo-container p {
    color: #64748b;
    font-size: 0.9rem;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    border-color: var(--secondary-color);
    outline: none;
}

.login-form button {
    width: 100%;
    padding: 12px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-form button:hover {
    background-color: #007a2f;
    transform: translateY(-2px);
}

.error-msg {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 10px;
    text-align: center;
    visibility: hidden;
}

/* Dashboard Header */
header {
    height: var(--header-height);
    background: var(--primary-color);
    color: white;
    padding: 0 5%;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand i {
    font-size: 2rem;
    color: var(--secondary-color);
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.brand span {
    font-size: 0.8rem;
    opacity: 0.7;
}

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

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--secondary-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--secondary-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

#logout-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

#logout-btn:hover {
    opacity: 1;
}

/* Dashboard Content */
.dashboard-grid {
    padding: 30px 5%;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* KPI Cards */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.kpi-card {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    border-left: 5px solid #cbd5e1;
    transition: transform 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
}

.kpi-card.highlight {
    border-left-color: var(--primary-color);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: #f1f5f9;
}

.kpi-icon.blue { color: var(--primary-color); background: #ebf0f7; }
.kpi-icon.green { color: var(--secondary-color); background: #ecfdf5; }

.kpi-info h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
}

.kpi-info p {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin: 5px 0;
}

.kpi-info span {
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-weight: 600;
}

/* Charts Section */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.chart-container {
    background: var(--white);
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    height: 400px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chart-container canvas {
    flex: 1;
    min-height: 0;
    width: 100% !important;
    height: auto !important;
}

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

.chart-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chart-header i {
    color: #64748b;
}

/* Bottom Row */
.bottom-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.table-container {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    width: 100%;
}

.table-row {
    margin-top: 10px;
    width: 100%;
}

.badge {
    background: #ecfdf5;
    color: #059669;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th {
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid #f1f5f9;
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
}

td {
    padding: 15px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}

.pcd-visual-card {
    background: var(--white);
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    height: 400px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pcd-visual-card canvas {
    flex: 1;
    min-height: 0;
    width: 100% !important;
    height: auto !important;
}

/* Ranking Section */
.ranking-row {
    margin-top: 30px;
}

.ranking-container {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.ranking-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #e2e8f0;
    transition: transform 0.2s;
}

.ranking-item:hover {
    transform: scale(1.02);
}

.rank-number {
    width: 35px;
    height: 35px;
    background: #e2e8f0;
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.ranking-item.top-1 { border-left-color: #FFD700; } /* Gold */
.ranking-item.top-2 { border-left-color: #C0C0C0; } /* Silver */
.ranking-item.top-3 { border-left-color: #CD7F32; } /* Bronze */

.ranking-item.top-1 .rank-number { background: #FFD700; color: #fff; }
.ranking-item.top-2 .rank-number { background: #C0C0C0; color: #fff; }
.ranking-item.top-3 .rank-number { background: #CD7F32; color: #fff; }

.rank-details {
    flex: 1;
}

.rank-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--primary-color);
}

.rank-score {
    font-size: 0.8rem;
    color: #64748b;
}

.rank-points {
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

/* Specific KPI colors */
.highlight-green {
    border-left-color: var(--secondary-color) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ranking-list { grid-template-columns: 1fr; }
}
