:root {
    --bg-color: #12110d;
    --card-bg: #1a1915;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --gold: #CFB56A; 
    --gold-dim: #8A7538;
    --danger: #ff4444;
    --success: #00C851;
    --font-main: 'Outfit', sans-serif;
    --nav-height: 70px; /* Height of bottom nav */
}

/* Global reset for touch behaviors */
* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    touch-action: manipulation; /* Prevent double-tap zoom globally */
    -webkit-overflow-scrolling: touch;
}

/* Prevent iOS Zoom on inputs */
input, select, textarea {
    font-size: 16px !important; /* Force 16px min to stop iOS zoom */
}

#app {
    min-height: 100%;
    height: auto;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-color);
    overflow-y: visible; /* Let body handle scroll */
    -webkit-overflow-scrolling: touch;
}

/* Header & Navigation */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 0px; /* Reduced margin */
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary); /* Changed to secondary as per design */
    font-size: 20px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
    color: var(--gold);
    background: rgba(207, 181, 106, 0.1);
}

.logo-container {
    /* border: 1px solid var(--gold); REMOVED border as per clean design */
    /* border-radius: 12px; */
    padding: 8px 16px;
    text-align: center;
}

.logo-icon {
    font-size: 24px;
    color: var(--gold);
    line-height: 1;
    margin-bottom: 4px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--gold);
    font-weight: 600;
}

/* Dashboard Styles */
.dashboard-container {
    padding: 0 20px 100px 20px; /* Added bottom padding for nav bar */
    display: flex;
    flex-direction: column;
    min-height: 100%;
    box-sizing: border-box;
}

.balance-section {
    text-align: center;
    margin-bottom: 20px;
}

/* --- ACTION CIRCLES --- */
.action-circles-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 10px;
}

.action-circle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.action-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--gold);
    font-size: 20px;
    transition: transform 0.2s, background 0.2s;
}

.action-circle-item:hover .action-circle {
    background: rgba(207, 181, 106, 0.1);
    transform: scale(1.05);
}

.action-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- SUPERFLY CARD COMPACT --- */
.superfly-card-compact {
    background: linear-gradient(135deg, #2a2a2a 0%, #111 100%);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-bg-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: radial-gradient(circle at top right, rgba(207, 181, 106, 0.1), transparent 60%);
    pointer-events: none;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 1;
}

.card-title {
    font-size: 14px;
    color: white;
    font-weight: 600;
}

.card-chip {
    width: 30px;
    height: 20px;
    background: linear-gradient(135deg, #d4af37 0%, #f9e295 50%, #d4af37 100%);
    border-radius: 4px;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 1;
}

.btn-tap-pay {
    background: linear-gradient(90deg, #CFB56A 0%, #E5C578 100%);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    color: #000;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(207, 181, 106, 0.3);
    transition: transform 0.2s;
}

.btn-tap-pay:active {
    transform: scale(0.95);
}

.card-toggle {
    width: 40px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
}

.card-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: var(--gold);
    border-radius: 50%;
}

.card-balance-preview {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 10px;
}

/* --- BOTTOM NAV BAR --- */
.bottom-nav-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    /* Mobile: Full width, square corners (default) */
    max-width: 100%; 
    height: var(--nav-height);
    background: #000000; /* Deep black as per design */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom); /* iOS Safe Area */
}

/* Desktop / Tablet: Rounded corners and max-width */
@media (min-width: 480px) {
    .bottom-nav-bar {
        max-width: 480px;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        /* Optional: Add side borders if it floats above a larger bg */
        border-left: 1px solid rgba(255, 255, 255, 0.05);
        border-right: 1px solid rgba(255, 255, 255, 0.05);
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    width: 20%;
}

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

.nav-item i {
    font-size: 20px;
    margin-bottom: 2px;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
}

/* Modal and other existing styles below... */
/* Keeping existing styles but overrides above take precedence */

/* Slide Up Modal Animation */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex; /* Always flex for centering */
    justify-content: center;
    align-items: flex-end; /* Align to bottom for slide up */
    z-index: 1000;
    opacity: 0;
    visibility: hidden; /* Use visibility instead of display:none */
    pointer-events: none; /* Let clicks pass through when hidden */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active,
.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 480px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 25px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-sizing: border-box;
    border-top: 1px solid var(--gold);
    display: flex;
    flex-direction: column;
    touch-action: pan-y; /* Allow vertical touch scrolling */
}

/* Modal Drag Handle - Swipe to Close */
.modal-drag-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 0 auto 15px;
    flex-shrink: 0;
    cursor: grab;
}

.modal-drag-handle:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.5);
}

/* Disable transition during drag for smoother feel */
.modal-content.dragging {
    transition: none !important;
}

.modal-overlay.active .modal-content,
.modal-overlay.visible .modal-content {
    transform: translateY(0);
}

.modal-content.full-height {
    height: 85vh;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0; /* Header shouldn't shrink */
}

.modal-body {
    flex: 1;
    overflow-y: auto; /* Allow content to scroll independent of header */
    -webkit-overflow-scrolling: touch;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gold);
}

.close-modal {
    background: none;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #aaa;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 12px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: white;
    font-family: var(--font-main);
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--gold);
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: var(--gold);
    border: none;
    border-radius: 8px;
    color: #000;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    font-family: var(--font-main);
}

.btn-primary:hover {
    background: #e5c578;
}

.btn-secondary {
    width: 100%;
    padding: 15px;
    background: #333;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    font-family: var(--font-main);
    margin-top: 10px;
}

/* --- TRADE MODAL STYLES --- */
.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.trade-asset-select-wrapper {
    position: relative;
    flex: 1;
}

.trade-asset-select {
    width: 100%;
    padding: 12px 35px 12px 15px;
    background: #222;
    border: 1px solid #444;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.trade-asset-select:focus {
    outline: none;
    border-color: var(--gold);
}

.select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    font-size: 12px;
    pointer-events: none;
}

.trade-tabs {
    display: flex;
    gap: 5px;
    background: #222;
    padding: 4px;
    border-radius: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #888;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-main);
}

.tab-btn.active {
    background: var(--gold);
    color: #000;
}

.tab-btn:hover:not(.active) {
    color: white;
}

.trade-info-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid #2a2a2a;
}

.info-row span:first-child {
    color: #888;
}

.info-row span:last-child {
    color: white;
    font-weight: 600;
}

.input-group {
    margin-bottom: 20px;
}

.input-field {
    width: 100%;
    padding: 15px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    color: white;
    font-size: 18px;
    font-weight: 600;
    font-family: var(--font-main);
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: var(--gold);
}

.input-field.input-error {
    border-color: var(--danger);
}

.quick-actions {
    display: flex;
    gap: 8px;
}

.quick-btn {
    padding: 6px 12px;
    background: #333;
    border: none;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-main);
}

.quick-btn:hover {
    background: var(--gold);
    color: #000;
}

.trade-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(207, 181, 106, 0.1);
    border: 1px solid var(--gold-dim);
    border-radius: 12px;
    margin-bottom: 20px;
}

.trade-summary span:first-child {
    color: #888;
    font-size: 14px;
}

.highlight-value {
    color: var(--gold);
    font-size: 20px;
    font-weight: 700;
}

.btn-close {
    width: 100%;
    padding: 15px;
    background: transparent;
    border: 1px solid #444;
    border-radius: 12px;
    color: #888;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
    font-family: var(--font-main);
    transition: all 0.2s;
}

.btn-close:hover {
    border-color: #666;
    color: white;
}

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

/* Toast Notification */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--gold);
    padding: 16px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 400px;
    box-sizing: border-box;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    color: var(--gold);
    font-size: 20px;
}

.toast-message {
    font-size: 14px;
    color: white;
    font-weight: 500;
}

/* History List Styles */
.history-list {
    display: flex;
    flex-direction: column;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #222;
}

.history-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
    margin-right: 15px;
}

.history-info {
    flex: 1;
}

.history-title {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
}

.history-date {
    font-size: 10px;
    color: #666;
}

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

.amount {
    font-size: 14px;
    font-weight: 600;
    display: block;
}

.sub-amount {
    font-size: 10px;
    color: #666;
}

.amount.positive { color: var(--success); }
.amount.negative { color: var(--danger); }

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #666;
}

.profile-card {
    display: flex;
}

/* --- PORTFOLIO SECTION --- */
.portfolio-section {
    margin-top: 20px;
    padding-bottom: 20px; /* Extra space so last item isn't hidden by nav */
}

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

.portfolio-header .section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.portfolio-total {
    font-size: 14px;
    font-weight: 600;
    color: var(--gold);
}

.portfolio-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.portfolio-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.portfolio-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--gold-dim);
}

.portfolio-item:active {
    transform: scale(0.98);
}

.portfolio-item-info {
    display: flex;
    flex-direction: column;
    min-width: 80px;
}

.portfolio-asset-symbol {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

.portfolio-asset-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.portfolio-item-holdings {
    flex: 1;
    text-align: center;
}

.portfolio-amount {
    font-size: 12px;
    color: var(--text-secondary);
}

.portfolio-item-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 90px;
}

.portfolio-value {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.portfolio-change {
    font-size: 10px;
    font-weight: 500;
}

.portfolio-change.positive {
    color: var(--success);
}

.portfolio-change.negative {
    color: var(--danger);
}

.portfolio-empty {
    text-align: center;
    padding: 20px;
}
