/* ==========================================================================
   CoinHunter - 2-Euro Sammler WebApp Stylesheet
   Modern Glassmorphism, Premium Dark & Light Themes, Responsive Grid
   ========================================================================== */

:root {
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Clean, Bright Euro-Collector Theme (Default) */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-glow: rgba(217, 119, 6, 0.3);
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;
    
    /* Gold & Coin Accents */
    --gold-primary: #d97706;
    --gold-hover: #b45309;
    --gold-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    --silver-gradient: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

html.dark {
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --bg-card: #1e293b;
    --border-color: #334155;
    --border-glow: rgba(234, 179, 8, 0.25);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --gold-primary: #facc15;
    --gold-hover: #eab308;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(234, 179, 8, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.04) 0%, transparent 40%);
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 1.5rem;
}

.nav-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.brand-coin {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gold-gradient);
    border: 3px solid #fef08a;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.4);
    transition: transform var(--transition-normal);
}

.brand:hover .brand-coin {
    transform: rotate(15deg) scale(1.08);
}

.coin-symbol {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.15rem;
    color: #451a03;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 40%, var(--gold-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

html.light .brand-title {
    background: linear-gradient(135deg, #0f172a 40%, #b45309 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: -3px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    overflow: visible;
    padding: 0.25rem 0;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-btn:hover {
    color: var(--text-main);
    background: var(--bg-surface-hover);
}

.nav-btn.active {
    color: var(--gold-primary);
    background: rgba(234, 179, 8, 0.1);
    border-color: rgba(234, 179, 8, 0.3);
}

.badge {
    background: var(--bg-surface-hover);
    color: var(--text-main);
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    border: 1px solid var(--border-color);
}

.nav-btn.active .badge {
    background: var(--gold-primary);
    color: #451a03;
    border-color: transparent;
}

/* User Controls */
.user-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.theme-toggle {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-surface-hover);
}

.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    color: var(--text-main);
    font-family: var(--font-heading);
    font-weight: 600;
    transition: var(--transition-fast);
}

.user-avatar-btn:hover {
    border-color: var(--gold-primary);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold-gradient);
    color: #451a03;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    z-index: 200;
    animation: dropdownFade 0.18s ease-out;
}

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

.dropdown-header {
    padding: 0.75rem 0.75rem 0.5rem;
}

.dropdown-header strong {
    display: block;
    font-size: 0.95rem;
}

.dropdown-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.4rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-surface-hover);
}

.dropdown-item.text-danger {
    color: var(--danger);
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--gold-gradient);
    color: #451a03;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(234, 179, 8, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(234, 179, 8, 0.45);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-surface-hover);
    border-color: var(--gold-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text-main);
    background: var(--bg-surface-hover);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

.link-btn {
    background: none;
    border: none;
    color: var(--gold-primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-container {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    flex: 1;
}

/* Summary Bar */
.stats-summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.summary-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 0.2rem;
}

.highlight-gold {
    color: var(--gold-primary);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gold-gradient);
    border-radius: var(--radius-full);
    transition: width 0.5s ease-out;
}

.summary-progress-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold-primary);
    margin-top: 0.25rem;
}

/* Filter Toolbar */
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 0.65rem 2.5rem 0.65rem 2.75rem;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.15);
}

.clear-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.9rem;
}

.filter-selects {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

select {
    background: var(--bg-base);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

select:focus {
    border-color: var(--gold-primary);
}

.view-mode-toggle {
    display: flex;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

.mode-btn.active {
    background: var(--bg-surface);
    color: var(--gold-primary);
    box-shadow: var(--shadow-sm);
}

/* View Header */
.view-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.view-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.view-counter {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ==========================================================================
   Coins Grid & Cards (High-Performance 60 FPS Optimized)
   ========================================================================== */
.coins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.coin-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    cursor: pointer;
    content-visibility: auto;
    contain-intrinsic-size: 280px 340px;
    contain: layout style paint;
}

.coin-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(234, 179, 8, 0.45);
}

.coin-card-header {
    position: relative;
    padding: 1.5rem 1rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(234, 179, 8, 0.03);
}

.coin-image-container {
    width: 130px;
    height: 130px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coin-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.coin-card:hover .coin-img {
    transform: scale(1.05);
}

.coin-image-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--gold-gradient);
    border: 4px solid #fef08a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(234, 179, 8, 0.3);
}

.coin-placeholder-val {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.8rem;
    color: #451a03;
}

.coin-placeholder-country {
    font-size: 0.75rem;
    font-weight: 700;
    color: #78350f;
    text-transform: uppercase;
}

/* Status Badges */
.status-pill {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

.status-pill.in_collection {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.photo-badge {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(234, 179, 8, 0.9);
    color: #451a03;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 2;
}

.ai-scan-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.12), rgba(59, 130, 246, 0.12));
    border: 1px solid rgba(234, 179, 8, 0.35);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    gap: 0.75rem;
}

.ai-banner-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--text-main);
}

.ai-status-pill {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.ai-banner-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.2rem 0 0 0;
}

.edit-photo-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-base);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 0.25rem;
}

.edit-photo-preview-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.edit-photo-thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--gold-primary);
}

.status-pill.wishlist {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.4);
}

.status-pill.trade {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.country-flag-badge {
    position: absolute;
    top: 0.85rem;
    left: 0.85rem;
    font-size: 1.1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
}

/* Card Body */
.coin-card-body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.coin-meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.coin-year {
    font-weight: 700;
    color: var(--gold-primary);
}

.coin-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-main);
    margin-bottom: 0.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.coin-specs {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.coin-val-est {
    font-weight: 700;
    color: var(--gold-primary);
}

.coin-mintage {
    color: var(--text-dim);
    font-size: 0.78rem;
}

/* List View */
.coins-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.coins-list .coin-card {
    flex-direction: row;
    align-items: center;
    padding: 0.75rem 1.25rem;
}

.coins-list .coin-card-header {
    padding: 0;
    background: none;
}

.coins-list .coin-image-container {
    width: 60px;
    height: 60px;
}

.coins-list .coin-image-placeholder {
    width: 50px;
    height: 50px;
}

.coins-list .coin-placeholder-val {
    font-size: 1rem;
}

.coins-list .coin-placeholder-country {
    display: none;
}

.coins-list .coin-card-body {
    padding: 0 1.5rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.coins-list .coin-title {
    -webkit-line-clamp: 1;
    margin-bottom: 0;
    font-size: 1rem;
    max-width: 400px;
}

.coins-list .coin-specs {
    border-top: none;
    padding-top: 0;
    gap: 2rem;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: scaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.modal-lg {
    max-width: 780px;
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-main);
    border-color: var(--gold-primary);
}

.modal-header {
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
}

.modal-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

input:focus, textarea:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.15);
}

.form-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.auth-switch {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Coin Detail Modal Content */
.coin-detail-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
}

.coin-detail-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.coin-detail-img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.6));
    margin-bottom: 1rem;
}

.coin-detail-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.detail-table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}

.detail-table td {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-table td:first-child {
    color: var(--text-muted);
    font-weight: 500;
    width: 40%;
}

.detail-table td:last-child {
    font-weight: 600;
    color: var(--text-main);
}

.collector-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* Online Search Modal */
.online-search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.online-search-bar input {
    flex: 1;
}

.online-results-container {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.online-result-item {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: border-color var(--transition-fast);
}

.online-result-item:hover {
    border-color: var(--gold-primary);
}

.online-res-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
}

.online-res-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* GDPR Modal */
.gdpr-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.gdpr-card {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.gdpr-card h3 {
    font-size: 1.05rem;
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
}

.gdpr-card p, .gdpr-card ul {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.gdpr-card ul {
    padding-left: 1.25rem;
    margin-top: 0.5rem;
}

.btn-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.danger-card {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.05);
}

.danger-card h3 {
    color: var(--danger);
}

/* Statistics Section */
.stats-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.stat-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    font-size: 2.2rem;
}

.stat-number {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-main);
    display: block;
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stats-detail-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stats-detail-card h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
}

.table-responsive {
    overflow-x: auto;
}

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

.data-table th, .data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.data-table th {
    font-family: var(--font-heading);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.data-table tr:hover td {
    background: var(--bg-surface-hover);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 2000;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--gold-primary); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading & Empty States */
.loading-state, .empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(234, 179, 8, 0.2);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.25rem;
}

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

.empty-icon {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 0.4rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 440px;
    margin: 0 auto 1.5rem;
}

/* Clean Scanner Action Cards */
.scanner-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 600px) {
    .scanner-actions-grid {
        grid-template-columns: 1fr;
    }
}

.scan-action-card {
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scan-action-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.scan-action-card.primary-action {
    border-color: var(--gold-primary);
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
}

html.dark .scan-action-card.primary-action {
    background: linear-gradient(180deg, rgba(234, 179, 8, 0.1) 0%, var(--bg-surface) 100%);
}

.action-icon {
    font-size: 2.5rem;
}

.action-text strong {
    display: block;
    font-size: 1.05rem;
    font-family: var(--font-heading);
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.action-text small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.live-stream-toggle-row {
    text-align: center;
    margin-bottom: 1.25rem;
}

/* Live Camera Viewfinder Box */
.live-scanner-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.viewfinder-wrapper {
    position: relative;
    width: 100%;
    max-width: 440px;
    height: 380px;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

#camera-stream {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.coin-focus-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 3px dashed var(--gold-primary);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45), 0 0 20px rgba(234, 179, 8, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 1.25rem;
    pointer-events: none;
    animation: pulseRing 2s ease-in-out infinite;
}

@keyframes pulseRing {
    0%, 100% { border-color: var(--gold-primary); transform: translate(-50%, -50%) scale(1); }
    50% { border-color: #fef08a; transform: translate(-50%, -50%) scale(1.02); }
}

.focus-hint {
    background: rgba(0, 0, 0, 0.75);
    color: #fef08a;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    text-align: center;
}

.camera-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 440px;
}

.btn-lg {
    padding: 0.85rem 2rem;
    font-size: 1.05rem;
}

/* Photo Scanner */
.photo-scan-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-base);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.upload-dropzone:hover {
    border-color: var(--gold-primary);
    background: rgba(234, 179, 8, 0.03);
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.75rem;
}

.preview-box {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--gold-primary);
}

.scan-img-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanning-radar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(234, 179, 8, 0.15) 0%, transparent 70%);
}

.radar-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
    box-shadow: 0 0 15px var(--gold-primary);
    animation: radarScan 1.6s ease-in-out infinite alternate;
}

@keyframes radarScan {
    0% { top: 0%; }
    100% { top: 96%; }
}

.scan-result-card {
    background: var(--bg-surface);
    border: 2px solid var(--gold-primary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease-out;
}

.scan-match-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    gap: 0.5rem;
}

.scan-badge-gold {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--gold-primary);
    font-weight: 800;
    letter-spacing: 0.04em;
}

.scan-match-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.scan-coin-compare {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background: var(--bg-base);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.compare-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.compare-thumb {
    width: 85px;
    height: 85px;
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid var(--gold-primary);
    background: var(--bg-surface);
}

.compare-thumb.user-photo {
    border-color: var(--primary);
}

.compare-arrow {
    font-size: 1.5rem;
    color: var(--gold-primary);
    font-weight: 800;
}

.scan-coin-details p {
    font-size: 0.92rem;
    margin-bottom: 0.35rem;
}

/* Scan Alternatives Section */
.scan-alternatives-section {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    margin-bottom: 1.25rem;
}

.alt-header-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.alt-coins-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alt-coin-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.alt-coin-card:hover {
    border-color: var(--gold-primary);
    background: var(--bg-surface-hover);
    transform: translateX(3px);
}

.alt-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: contain;
    border: 1px solid var(--gold-primary);
    background: var(--bg-base);
    flex-shrink: 0;
}

.alt-info {
    flex: 1;
    min-width: 0;
}

.alt-info strong {
    display: block;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.alt-info small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-xs {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.scan-actions-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.confidence-tag {
    background: rgba(16, 185, 129, 0.15);
    color: #16a34a;
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Scan CTA Button in Header */
.btn-scan-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    background: var(--gold-gradient);
    color: #451a03;
    border: 1px solid #fef08a;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-scan-nav:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.btn-scan-nav:active {
    transform: translateY(0);
}

.btn-scan-highlight {
    background: rgba(234, 179, 8, 0.15) !important;
    border-color: rgba(234, 179, 8, 0.4) !important;
    color: var(--gold-primary) !important;
}

/* Utility Helpers */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
}

/* ==========================================================================
   Mobile Bottom Navigation Bar
   ========================================================================== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    z-index: 950;
    align-items: center;
    justify-content: space-around;
    padding: 0 0.5rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
    min-width: 54px;
}

.mobile-nav-item .mob-icon {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.mobile-nav-item.active {
    color: var(--gold-primary);
}

.mob-badge {
    position: absolute;
    top: 2px;
    right: 8px;
    background: var(--gold-primary);
    color: #451a03;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    min-width: 16px;
    text-align: center;
}

.mobile-nav-center-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    top: -14px;
}

.center-btn-inner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--gold-gradient);
    border: 3px solid var(--bg-surface);
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.center-btn-inner:active {
    transform: scale(0.92);
}

.center-btn-icon {
    font-size: 1.45rem;
}

.center-btn-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold-primary);
    margin-top: 2px;
}

/* Native Touch Input Overlay for iOS & Mobile Browsers */
.scan-action-card {
    position: relative;
    overflow: hidden;
}

.scan-input-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.0001;
    z-index: 20;
    cursor: pointer;
    font-size: 0;
}

/* ==========================================================================
   Mobile Menu & Sheet Modal
   ========================================================================== */
.mobile-menu-card {
    max-width: 460px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.mobile-menu-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
    padding: 0.25rem 0;
    margin-bottom: 0.75rem;
}

.mobile-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mobile-menu-btn:hover, .mobile-menu-btn:active {
    background: var(--bg-surface-hover);
    border-color: var(--border-color);
}

.mobile-menu-btn .m-icon {
    font-size: 1.25rem;
    min-width: 24px;
    text-align: center;
}

.mobile-menu-footer {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.mt-2 { margin-top: 0.5rem; }
.block { display: block; }

/* Responsive Layout */
@media (max-width: 900px) {
    body {
        padding-bottom: 80px; /* Safe space for sticky bottom nav on iPhone & Tablets */
    }

    .nav-links {
        display: none !important; /* Clean up top bar: handled by bottom nav & sheet menu */
    }

    .navbar {
        padding: 0.5rem 1rem;
    }

    .nav-container {
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .brand-title {
        font-size: 1.15rem;
    }

    .brand-subtitle {
        display: none;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .btn-scan-nav {
        display: none; /* Replaced by bottom nav center button on mobile */
    }
    
    .coin-detail-layout {
        grid-template-columns: 1fr;
    }
    
    .filter-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-selects {
        width: 100%;
    }
    
    .filter-selects select {
        flex: 1;
    }
    
    .stats-summary-card {
        grid-template-columns: 1fr 1fr;
    }
}
