/* ===================================================
   ONCHAIN EXCHANGE - Light Mobile-First Theme
   Clone of onchainwebonline.com Design
 =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-page: linear-gradient(135deg, #f1f5f9, #cbd5e1);
    --bg-frame: #f8fafc;
    --bg-card-dark: #1e293b;
    --bg-card-light: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-teal: #0d9488;
    --accent-teal-light: #ccfbf1;
    --accent-blue: #2563eb;
    --accent-blue-light: #dbeafe;
    --accent-red: #dc2626;
    --accent-red-light: #fee2e2;
    --accent-green: #16a34a;
    --accent-green-light: #dcfce7;
    --accent-yellow: #d97706;
    --accent-yellow-light: #fef3c7;
    --border: #e2e8f0;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.08);
}

/* Reset and Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Mobile Frame Container */
.mobile-frame {
    width: 100%;
    max-width: 460px;
    min-height: 100vh;
    background: var(--bg-frame);
    box-shadow: var(--shadow-lg);
    position: relative;
    display: flex;
    flex-direction: column;
    padding-bottom: 96px; /* spacing for bottom nav */
}

/* Header Topbar */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-frame);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.header-logo-icon {
    width: 32px;
    height: 32px;
    background: #0f172a;
    border-radius: 8px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
}

.header-logo-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: all 0.2s;
}

.header-btn:hover {
    background: #f1f5f9;
}

/* Main Content Container */
.app-content {
    padding: 16px 20px;
    flex: 1;
}

/* Balance Card */
.balance-card {
    background: var(--bg-card-dark);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: #ffffff;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
}

.balance-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    pointer-events: none;
}

.balance-label {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.balance-amount {
    font-size: 32px;
    font-weight: 800;
    margin: 8px 0;
    letter-spacing: -0.5px;
}

.balance-pnl {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.balance-pnl-label {
    color: var(--text-muted);
}

.balance-pnl-value {
    font-weight: 600;
    color: var(--accent-teal);
}

.balance-card-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.balance-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.balance-btn.primary {
    background: #ffffff;
    color: var(--text-primary);
}

.balance-btn.secondary {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #ffffff;
}

.balance-btn.primary:hover {
    background: #f1f5f9;
}

.balance-btn.secondary:hover {
    background: rgba(255,255,255,0.05);
}

/* Quick Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    transition: transform 0.2s;
}

.action-item:active {
    transform: scale(0.95);
}

.action-icon-wrapper {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.action-item.deposit .action-icon-wrapper {
    background: var(--accent-teal-light);
    color: var(--accent-teal);
}

.action-item.withdraw .action-icon-wrapper {
    background: var(--accent-red-light);
    color: var(--accent-red);
}

.action-item.convert .action-icon-wrapper {
    background: var(--accent-blue-light);
    color: var(--accent-blue);
}

.action-item.markets .action-icon-wrapper {
    background: var(--accent-yellow-light);
    color: var(--accent-yellow);
}

/* Tabs */
.tabs-header {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.tab-btn {
    padding: 10px 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    outline: none;
}

.tab-btn.active {
    color: var(--text-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
}

/* Card Wrapper (Light Theme) */
.content-card {
    background: var(--bg-card-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.content-card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Asset Row Items */
.asset-list {
    display: flex;
    flex-direction: column;
}

.asset-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

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

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

.asset-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.asset-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.asset-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.asset-price-block {
    text-align: right;
}

.asset-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.asset-change-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
}

.asset-change-badge.up {
    background: var(--accent-green-light);
    color: var(--accent-green);
}

.asset-change-badge.down {
    background: var(--accent-red-light);
    color: var(--accent-red);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 428px;
    height: 68px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding: 0 8px;
    border: 1px solid rgba(255,255,255,0.4);
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
}

.nav-link-icon {
    font-size: 18px;
}

/* Float center button on Wallet */
.nav-link-float {
    position: relative;
    top: -12px;
}

.nav-link-float .nav-link-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-teal);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.3);
    transition: all 0.2s;
}

.nav-link-float.active .nav-link-icon {
    background: #0f172a;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.3);
}

/* Inputs and Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--text-primary);
    background: #ffffff;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    pointer-events: none;
}

.input-group .form-control {
    padding-left: 28px;
}

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

.btn-primary {
    background: #0f172a;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1e293b;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-full {
    width: 100%;
}

.btn-buy {
    background: var(--accent-green);
    color: #ffffff;
    flex: 1;
}

.btn-sell {
    background: var(--accent-red);
    color: #ffffff;
    flex: 1;
}

/* Alert Boxes */
.alert {
    padding: 14px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: var(--accent-green-light);
    color: var(--accent-green);
}

.alert-error {
    background: var(--accent-red-light);
    color: var(--accent-red);
}

/* Auth Screens */
.auth-page {
    min-height: 100vh;
    width: 100vw;
    background: var(--bg-page);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 48px;
    height: 48px;
    background: #0f172a;
    border-radius: 12px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 24px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-lg);
}

.auth-logo-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.auth-logo-tagline {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.auth-card {
    background: var(--bg-card-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 32px 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.auth-card-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-card-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin: 20px 0;
}

.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.auth-divider span {
    padding: 0 10px;
}

.auth-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

.auth-link:hover {
    text-decoration: underline;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Responsive adjustments */
@media (max-width: 480px) {
    body {
        background: var(--bg-frame);
    }
    .mobile-frame {
        box-shadow: none;
    }
}
