:root {
    --bg-dark: #07040f;
    --panel-bg: rgba(18, 12, 32, 0.65);
    --panel-border: rgba(139, 92, 246, 0.15);
    --panel-hover: rgba(139, 92, 246, 0.25);
    
    --text-primary: #f5f3ff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #8b5cf6;
    --primary-hover: #a78bfa;
    --secondary: #3b82f6;
    --secondary-hover: #60a5fa;
    
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --gold: #f59e0b;
    --info: #06b6d4;
    
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --border-radius: 12px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Glowing Background Circles */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.12) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 45%);
    z-index: -1;
    pointer-events: none;
}

/* Glassmorphism Panel Template */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.3s ease;
}

.glass-panel:hover {
    border-color: rgba(139, 92, 246, 0.25);
}

/* Main Container Layout */
.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100vh;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
}

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

.logo-icon {
    font-size: 28px;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo .subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-top: 1px;
}

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

.sync-status {
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.character-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Custom Select Dropdown */
.custom-select {
    background: rgba(18, 12, 32, 0.85);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    outline: none;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s;
}

.custom-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 20px 0 rgba(139, 92, 246, 0.6);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    align-items: start;
}

/* Sidebar Navigation */
.sidebar {
    padding: 20px 10px;
}

.sidebar ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-primary);
    border-left: 3px solid var(--primary);
}

.nav-icon {
    font-size: 16px;
}

/* Content Container & Tabs */
.content-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

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

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 20px;
    padding: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group input {
    background: rgba(18, 12, 32, 0.85);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    outline: none;
    font-family: var(--font-main);
    transition: all 0.3s;
}

.filter-group input:focus {
    border-color: var(--primary);
}

/* Custom Table Design */
.table-container {
    padding: 20px;
    overflow-x: auto;
}

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

.table-header-flex h2 {
    font-family: var(--font-heading);
    font-size: 18px;
}

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

th {
    padding: 12px 16px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

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

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

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

.font-gold {
    color: var(--gold);
    font-weight: 600;
}

/* Alerts and Volatility Warning Banner */
.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-banner {
    padding: 12px 20px;
    border-radius: var(--border-radius);
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--text-primary);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-icon {
    font-size: 16px;
    color: var(--danger);
}

/* Grids & Cards */
.stats-grid, .order-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.stat-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
}

.stat-number {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
}

.card-footer {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .grid-2-col {
        grid-template-columns: 1fr;
    }
    
    .main-layout {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 400px;
}

/* Settings and Reference cards */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.settings-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.settings-card h2 {
    font-family: var(--font-heading);
    font-size: 18px;
}

.desc-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.character-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.char-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-info h4 {
    font-size: 14px;
    font-weight: 600;
}

.char-info p {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-icon-danger {
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}

.btn-icon-danger:hover {
    color: var(--danger);
}

/* Bullet list */
.bullet-list {
    margin-left: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Badges */
.badge {
    padding: 3px 8px;
    font-size: 10px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-danger { background: rgba(244, 63, 148, 0.15); color: var(--danger); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(18, 12, 32, 0.95);
    border: 1px solid var(--primary);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    transition: transform 0.3s ease, opacity 0.3s ease;
    font-size: 13px;
}

.toast.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* Utility spacers */
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.btn-block { width: 100%; display: flex; justify-content: center; }

/* Dynamic visibility classes */
.hidden {
    display: none !important;
}

/* Landing / Google Login page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

.login-card {
    max-width: 480px;
    width: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.login-logo-icon {
    font-size: 56px;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
    margin-bottom: 10px;
}

.login-card h2 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
}

.btn-google {
    background: #ffffff;
    color: #1f2937;
    border: none;
    font-weight: 600;
    font-size: 15px;
    font-family: var(--font-main);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.btn-google:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 255, 255, 0.15);
}

.login-footer {
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 15px;
    width: 100%;
}

.small-text {
    font-size: 11px;
    color: var(--text-muted);
}

/* User profile header */
.user-profile-section {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--primary);
    object-fit: cover;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.table-row-danger td {
    background: rgba(244, 63, 94, 0.05) !important;
    border-bottom: 1px solid rgba(244, 63, 94, 0.2) !important;
}

.table-row-danger:hover td {
    background: rgba(244, 63, 94, 0.08) !important;
}

/* Minor Warning Row styling */
.table-row-warning td {
    background: rgba(245, 158, 11, 0.04) !important;
    border-bottom: 1px solid rgba(245, 158, 11, 0.15) !important;
}

.table-row-warning:hover td {
    background: rgba(245, 158, 11, 0.07) !important;
}

/* Pagination Bar */
.pagination-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.page-info {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Card Footer Rows (Multi-line info inside stat card footers) */
.card-footer-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.footer-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.footer-row .value {
    font-weight: 600;
}

.border-top-glow {
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    padding-top: 5px;
}
.mt-5 { margin-top: 5px; }

/* Item name copy button cell styling */
.item-name-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.btn-copy-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 3px 6px;
    font-size: 11px;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.25;
}

tr:hover .btn-copy-icon {
    opacity: 0.8;
}

.btn-copy-icon:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.08);
    opacity: 1 !important;
}

.btn-copy-icon:active {
    transform: scale(0.9);
}
