/* ==========================================================================
   KRYPTO//NEXUS - Futuristic Glassmorphic Stylesheet
   ========================================================================== */

/* Theme Variables */
:root {
    --font-heading: 'Orbitron', -apple-system, sans-serif;
    --font-body: 'Rajdhani', -apple-system, sans-serif;
    
    /* Default Cyber Neon Theme */
    --bg-base: #070913;
    --glass-bg: rgba(15, 23, 42, 0.55);
    --glass-card-bg: rgba(17, 24, 39, 0.65);
    --glass-border: rgba(56, 189, 248, 0.2);
    --glass-border-hover: rgba(56, 189, 248, 0.5);
    --glass-glow: rgba(56, 189, 248, 0.15);
    
    --accent-primary: #00f0ff;
    --accent-secondary: #ff007f;
    --accent-glow: 0 0 20px rgba(0, 240, 255, 0.4);
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    
    --positive: #00ff9d;
    --positive-glow: rgba(0, 255, 157, 0.2);
    --negative: #ff3366;
    --negative-glow: rgba(255, 51, 102, 0.2);
    
    --orb-1: #00f0ff;
    --orb-2: #7928ca;
    --orb-3: #ff007f;
}

/* Theme variations */
[data-theme="nebula-purple"] {
    --bg-base: #0b0714;
    --glass-bg: rgba(24, 15, 42, 0.6);
    --glass-card-bg: rgba(29, 18, 51, 0.7);
    --glass-border: rgba(168, 85, 247, 0.25);
    --glass-border-hover: rgba(168, 85, 247, 0.6);
    --glass-glow: rgba(168, 85, 247, 0.2);
    
    --accent-primary: #a855f7;
    --accent-secondary: #ec4899;
    --accent-glow: 0 0 20px rgba(168, 85, 247, 0.5);
    
    --orb-1: #a855f7;
    --orb-2: #ec4899;
    --orb-3: #3b82f6;
}

[data-theme="emerald-matrix"] {
    --bg-base: #04100c;
    --glass-bg: rgba(6, 32, 24, 0.6);
    --glass-card-bg: rgba(8, 41, 30, 0.7);
    --glass-border: rgba(16, 185, 129, 0.25);
    --glass-border-hover: rgba(16, 185, 129, 0.6);
    --glass-glow: rgba(16, 185, 129, 0.2);
    
    --accent-primary: #10b981;
    --accent-secondary: #00f0ff;
    --accent-glow: 0 0 20px rgba(16, 185, 129, 0.5);
    
    --orb-1: #10b981;
    --orb-2: #059669;
    --orb-3: #06b6d4;
}

[data-theme="solar-gold"] {
    --bg-base: #120b04;
    --glass-bg: rgba(36, 20, 8, 0.6);
    --glass-card-bg: rgba(46, 26, 10, 0.7);
    --glass-border: rgba(245, 158, 11, 0.25);
    --glass-border-hover: rgba(245, 158, 11, 0.6);
    --glass-glow: rgba(245, 158, 11, 0.2);
    
    --accent-primary: #f59e0b;
    --accent-secondary: #ef4444;
    --accent-glow: 0 0 20px rgba(245, 158, 11, 0.5);
    
    --orb-1: #f59e0b;
    --orb-2: #d97706;
    --orb-3: #ef4444;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Floating Glass Background Orbs */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
    animation: floatOrb 18s ease-in-out infinite alternate;
}

.orb-1 {
    width: 350px;
    height: 350px;
    background: var(--orb-1);
    top: -50px;
    left: -50px;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--orb-2);
    bottom: -100px;
    right: -50px;
    animation-delay: -6s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--orb-3);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -12s;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -40px) scale(1.1); }
    100% { transform: translate(-20px, 30px) scale(0.95); }
}

/* Layout */
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Glassmorphism Generic Class */
.glass-card {
    background: var(--glass-card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Glass Buttons & Controls */
.glass-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px 16px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
    user-select: none;
}

.glass-btn:hover, .glass-btn:active {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent-primary);
    box-shadow: var(--accent-glow);
    transform: translateY(-1px);
}

.glass-btn.accent-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #000;
    border: none;
    font-weight: 700;
}

.glass-btn.accent-btn:hover {
    filter: brightness(1.15);
    box-shadow: var(--accent-glow);
}

.icon-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 14px;
    position: relative;
}

/* Header */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
}

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

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    position: relative;
}

.pulse-ring {
    position: absolute;
    inset: -2px;
    border-radius: 14px;
    border: 1px solid var(--accent-primary);
    animation: pulseRing 2s infinite;
    opacity: 0.6;
}

@keyframes pulseRing {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 0; }
    100% { transform: scale(0.95); opacity: 0; }
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 1px;
}

.accent-text {
    color: var(--accent-primary);
    text-shadow: var(--accent-glow);
}

.live-tag {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--positive);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--positive);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--positive);
}

.dot.blink {
    animation: blink 1.2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

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

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-secondary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Theme Dropdown */
.theme-selector-wrapper {
    position: relative;
}

.theme-dropdown {
    position: absolute;
    top: 52px;
    right: 0;
    width: 180px;
    padding: 8px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.theme-option {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.theme-option:hover, .theme-option.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-primary);
}

.theme-color-preview {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}
.theme-color-preview.cyber { background: #00f0ff; }
.theme-color-preview.nebula { background: #a855f7; }
.theme-color-preview.emerald { background: #10b981; }
.theme-color-preview.solar { background: #f59e0b; }

/* Hero Stats Bar */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 14px 20px;
    align-items: center;
    gap: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 700;
}

.stat-divider {
    display: none;
}

/* Select Inputs */
.glass-select, .glass-select-clean {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.glass-select option, .glass-select-clean option {
    background: var(--bg-base);
    color: #fff;
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 10px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.view-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-pills {
    display: flex;
    padding: 4px;
    gap: 4px;
    overflow-x: auto;
    max-width: 100%;
}

.pill-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.pill-btn:hover {
    color: var(--text-main);
}

.pill-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--accent-primary);
    box-shadow: inset 0 0 10px var(--glass-glow);
}

/* Crypto Feed Grid */
.crypto-feed {
    min-height: 400px;
    position: relative;
}

.crypto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

/* Crypto Card Item */
.crypto-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.crypto-card:hover {
    border-color: var(--glass-border-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), var(--accent-glow);
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.coin-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
}

.coin-titles {
    display: flex;
    flex-direction: column;
}

.coin-name {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
}

.coin-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.rank-badge {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.65rem;
}

.fav-star {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.2);
    transition: transform 0.2s, color 0.2s;
    padding: 4px;
}

.fav-star.active {
    color: #ffca28;
    text-shadow: 0 0 10px rgba(255, 202, 40, 0.5);
}

.card-middle {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.price-container {
    display: flex;
    flex-direction: column;
}

.card-price {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
}

.badge-change {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    width: fit-content;
    margin-top: 4px;
}

.badge-change.positive {
    background: var(--positive-glow);
    color: var(--positive);
    border: 1px solid rgba(0, 255, 157, 0.3);
}

.badge-change.negative {
    background: var(--negative-glow);
    color: var(--negative);
    border: 1px solid rgba(255, 51, 102, 0.3);
}

/* Sparkline Canvas */
.sparkline-container {
    width: 110px;
    height: 40px;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 8px;
}

/* Loading Spinner */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    gap: 16px;
    color: var(--text-muted);
}

.cyber-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: var(--accent-glow);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.empty-icon {
    font-size: 3rem;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-content {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.modal-coin-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.badge-symbol {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 6px;
}

.badge-rank {
    font-size: 0.75rem;
    color: var(--accent-primary);
}

.modal-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-price-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-price {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
}

.chart-container {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
}

.chart-live-indicator {
    color: var(--positive);
    display: flex;
    align-items: center;
    gap: 4px;
}

.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.modal-stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.modal-stat-box .label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.modal-stat-box .val {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 2px;
}

/* Kalkylator Box */
.calc-box {
    padding: 14px;
}

.calc-box h4 {
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.calc-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calc-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calc-field label {
    font-size: 0.7rem;
    color: var(--accent-primary);
    font-weight: 700;
}

.calc-field input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    outline: none;
    width: 100%;
}

.calc-equals {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-top: 14px;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Portfolio Modal Items */
.portfolio-summary {
    padding: 16px;
    text-align: center;
}

.portfolio-val {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-primary);
    text-shadow: var(--accent-glow);
}

.portfolio-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
}

.portfolio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.portfolio-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.remove-port-btn {
    background: none;
    border: none;
    color: var(--negative);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
}

/* Footer */
.glass-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .brand-text h1 {
        font-size: 1rem;
    }

    .crypto-grid {
        grid-template-columns: 1fr;
    }

    .view-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-wrapper {
        width: 100%;
    }

    .glass-select-clean {
        width: 100%;
    }
}
