:root {
    --primary-color: #ff4d6d;
    --primary-gradient: linear-gradient(135deg, #ff4d6d 0%, #ff758f 100%);
    --bg-dark: #0a0e14;
    --card-bg: rgba(30, 35, 45, 0.7);
    --text-main: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --hypo: #ff4d6d;
    --target: #4cc9f0;
    --hyper: #f72585;
    --success: #4ade80;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glassmorphism Classes */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

/* Login Screen */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #1a2333 0%, #0a0e14 100%);
}

.login-card {
    width: 400px;
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

.logo-container {
    margin-bottom: 40px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
}

.logo-container h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.logo-container p {
    color: var(--text-secondary);
    font-size: 14px;
}

.google-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: white;
    color: #333;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.google-btn:hover {
    background: #f1f1f1;
    transform: scale(1.02);
}

.google-btn img {
    width: 20px;
}

/* Dashboard Navigation */
.glass-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 40px;
    background: rgba(10, 14, 20, 0.8);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--glass-border);
}

.nav-logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 20px;
}

.user-info img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.nav-right {
    display: flex;
    align-items: center;
}

.nav-btn {
    padding: 8px 20px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.nav-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Dashboard Content */
.dashboard-content {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    text-align: center;
    transition: 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.stat-card h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 40px;
    font-weight: 800;
    margin-bottom: 4px;
}

.stat-value.small {
    font-size: 32px;
}

.stat-unit {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Charts */
.charts-container {
    margin-bottom: 40px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.chart-card {
    height: 450px;
    display: flex;
    flex-direction: column;
}

canvas#glucoseChart {
    flex-grow: 1;
    min-height: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.chart-controls {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge.hypo {
    background: rgba(255, 77, 109, 0.2);
    color: #ff4d6d;
}

.badge.target {
    background: rgba(76, 201, 240, 0.2);
    color: #4cc9f0;
}

.badge.hyper {
    background: rgba(247, 37, 133, 0.2);
    color: #f72585;
}

/* History Table */
.table-card {
    padding: 0;
    overflow: hidden;
}

.table-card .card-header {
    padding: 24px 24px 0;
}

.table-responsive {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    table-layout: fixed;
}

th {
    text-align: left;
    padding: 16px 24px;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td:last-child {
    white-space: normal;
    word-break: break-word;
}

th:nth-child(1),
td:nth-child(1) {
    width: 25%;
}

th:nth-child(2),
td:nth-child(2) {
    width: 15%;
}

th:nth-child(3),
td:nth-child(3) {
    width: 12%;
}

th:nth-child(4),
td:nth-child(4) {
    width: 12%;
}

th:nth-child(5),
td:nth-child(5) {
    width: 12%;
}

th:nth-child(6),
td:nth-child(6) {
    width: 24%;
}

tr:last-child td {
    border-bottom: none;
}

.type-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.type-glucose {
    background: rgba(76, 201, 240, 0.15);
    color: #4cc9f0;
}

.type-rapid {
    background: rgba(255, 77, 109, 0.15);
    color: #ff4d6d;
}

.type-slow {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

/* Loader */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 20, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 77, 109, 0.2);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .dashboard-content {
        padding: 20px;
    }

    .glass-nav {
        padding: 16px 20px;
    }

    .stat-card {
        padding: 20px;
    }
}