:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --positive: #10b981;
    --negative: #ef4444;
    --font-stack: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-stack);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* subtle gradient background */
    background: radial-gradient(circle at top right, #1e1b4b 0%, var(--bg-dark) 50%, #020617 100%);
    background-attachment: fixed;
}

.login-bg {
    display: flex;
    align-items: center;
    justify-content: center;
}

a {
    text-decoration: none;
    color: var(--primary);
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Typography */
h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Login */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    padding: 40px;
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-stack);
    font-size: 1rem;
    transition: all 0.2s ease;
}

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

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    font-family: var(--font-stack);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active {
    transform: translateY(1px);
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.error-alert {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.hidden {
    display: none !important;
}

/* Dashboard Nav */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

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

.logo-icon {
    font-size: 1.5rem;
}

.brand-text {
    display: block;
    font-weight: 600;
    font-size: 1.2rem;
}

.brand-subtext {
    display: block;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

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

.username {
    color: var(--text-muted);
    font-weight: 300;
}

.btn-logout {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-main);
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Dashboard Content */
.container {
    padding: 40px 30px;
    max-width: 1200px;
    margin: 0 auto;
    flex-grow: 1;
    width: 100%;
}

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

.btn-refresh {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-stack);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-refresh .icon {
    display: inline-block;
    transition: transform 0.5s ease;
}

.btn-refresh.loading .icon {
    transform: rotate(360deg);
}

/* Table */
.table-container {
    overflow-x: auto;
    padding: 1px;
    /* To prevent child rounding cutoffs */
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.styled-table th {
    background: rgba(0, 0, 0, 0.2);
    padding: 16px 20px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.styled-table th:hover {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-main);
}

.styled-table th:first-child {
    border-top-left-radius: 16px;
}

.styled-table th:last-child {
    border-top-right-radius: 16px;
}

.sort-icon {
    margin-left: 5px;
    opacity: 0.3;
    font-size: 0.9em;
}

th.asc .sort-icon {
    opacity: 1;
    content: "\2191";
}

/* Up arrow visual cheat, but ⇅ is used so we highlight it via color instead */
th.desc .sort-icon {
    opacity: 1;
    color: var(--primary);
}

th.asc .sort-icon {
    color: var(--primary);
    transform: scaleY(-1);
    display: inline-block;
}

.styled-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.chart-cell {
    padding: 8px 20px !important;
    /* reduce padding for the chart cell to balance the height */
}

.styled-table tr:last-child td {
    border-bottom: none;
}

.styled-table tbody tr {
    transition: background 0.2s ease;
}

.styled-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

.coin-cell {
    vertical-align: middle;
}

.coin-cell-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.coin-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #334155;
}

.apr-highlight {
    color: var(--primary);
    font-weight: 700;
}

.positive {
    color: var(--positive);
    font-weight: 500;
}

.negative {
    color: var(--negative);
    font-weight: 500;
}

/* Loader */
.loader-container {
    padding: 60px 0;
    text-align: center;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 15px;
}

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

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}