/**
 * Ledger-Inspired Professional Mining Platform
 * Auto Dark/Light Theme + Ledger Design System
 */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

/* Theme Variables - Light Mode (Default) */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f9fc;
    --bg-card: #ffffff;
    
    --primary: #0ebdcd;
    --primary-hover: #0ca5b3;
    --primary-light: rgba(14, 189, 205, 0.1);
    
    --secondary: #6490f1;
    
    --success: #27ae60;
    --warning: #ff9500;
    --danger: #eb5757;
    
    --text-primary: #142533;
    --text-secondary: #6a7985;
    --text-tertiary: #9da5ae;
    
    --border: #e4e8ed;
    
    --shadow-sm: 0 1px 3px rgba(20, 37, 51, 0.04);
    --shadow-md: 0 4px 12px rgba(20, 37, 51, 0.08);
    --shadow-lg: 0 12px 32px rgba(20, 37, 51, 0.12);
}

/* Dark Mode (Auto-detect system preference) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f1419;
        --bg-secondary: #16191e;
        --bg-card: #16191e;
        
        --primary: #0ebdcd;
        --primary-hover: #1dcee0;
        --primary-light: rgba(14, 189, 205, 0.15);
        
        --secondary: #6490f1;
        
        --success: #2ecc71;
        --warning: #ff9500;
        --danger: #eb5757;
        
        --text-primary: #e8ecef;
        --text-secondary: #9da5ae;
        --text-tertiary: #6a7985;
        
        --border: #2a2f37;
        
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    }
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
}

/* Crypto Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(circle at 20% 20%, var(--primary) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, var(--secondary) 0%, transparent 40%);
}

body::after {
    content: '₿ Ł Ξ ◊ ₿ Ł Ξ ◊ ₿ Ł Ξ ◊';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-12deg);
    font-size: 8rem;
    font-weight: 200;
    color: var(--text-tertiary);
    opacity: 0.02;
    white-space: nowrap;
    pointer-events: none;
    z-index: 0;
    letter-spacing: 4rem;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 80px;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 18px;
}

.header-logo img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.header-nav {
    margin-top: 12px;
}

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

.header-nav a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header i {
    color: var(--primary);
}

/* Mining Fan */
.mining-fan-container {
    display: flex;
    justify-content: center;
    padding: 48px 0;
}

.mining-fan {
    width: 180px;
    height: 180px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fan-outer, .fan-inner {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
                linear-gradient(135deg, var(--primary), var(--secondary)) border-box;
}

.fan-outer {
    width: 180px;
    height: 180px;
    animation: rotate-outer 20s linear infinite;
}

.fan-inner {
    width: 140px;
    height: 140px;
    animation: rotate-inner 15s linear infinite reverse;
}

.ltc-logo-center {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 2;
}

.ltc-logo-center img {
    width: 48px;
    height: 48px;
    filter: brightness(0) invert(1);
}

.mining-fan.active .fan-outer {
    animation: rotate-outer 4s linear infinite;
}

.mining-fan.active .fan-inner {
    animation: rotate-inner 3s linear infinite reverse;
}

@keyframes rotate-outer {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotate-inner {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

/* Balance Card */
.balance-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-align: center;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    border: none;
}

.balance-label {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.balance-amount {
    font-size: 32px;
    font-weight: 700;
    font-family: 'SF Mono', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 16px 0;
}

.balance-amount img {
    width: 40px;
    height: 40px;
    filter: brightness(0) invert(1);
}

.power-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.stat-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    font-family: 'SF Mono', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.stat-value img {
    width: 20px;
    height: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.input-group {
    position: relative;
}

.input-suffix {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    pointer-events: none;
}

.input-suffix img {
    width: 20px;
    height: 20px;
}

/* Calculator */
.calculator {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 12px;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.calc-row:last-child {
    border-bottom: none;
}

.calc-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.calc-value {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'SF Mono', monospace;
    font-weight: 600;
}

.calc-value img {
    width: 18px;
    height: 18px;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 480px;
    width: 100%;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 8px;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
}

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

.nav-label {
    font-size: 11px;
    font-weight: 600;
}

/* Referral */
.referral-code-box {
    text-align: center;
    padding: 32px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 2px dashed var(--border);
}

.referral-code {
    font-size: 32px;
    font-weight: 700;
    font-family: 'SF Mono', monospace;
    color: var(--primary);
    letter-spacing: 4px;
    margin: 24px 0;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.referral-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.referral-stat {
    text-align: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.referral-stat:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.referral-stat-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.referral-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.mt-3 { margin-top: 24px; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
