/* NGX Tracker Pro - Polished Dark Theme */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #008751;
    --primary-light: #00a854;
    --accent: #00d4ff;
    --success: #00c853;
    --danger: #ff5252;
    --bg: #0a0a0f;
    --card: #151520;
    --card-hover: #1a1a25;
    --text: #ffffff;
    --text-secondary: #8b8b9e;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
    padding-bottom: 90px;
    -webkit-tap-highlight-color: transparent;
}
.container { max-width: 800px; margin: 0 auto; padding: 20px; }

/* Header */
.header { text-align: center; padding: 20px 0; margin-bottom: 10px; }
.header h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.greeting { color: var(--text-secondary); font-size: 14px; margin-top: 5px; }

/* Portfolio Value Card */
.card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16162a 100%);
    border-radius: 24px;
    padding: 25px;
    margin-bottom: 15px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    text-align: center;
}
.stat-label { 
    color: var(--text-secondary); 
    font-size: 13px; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-bottom: 10px; 
    text-align: center;
}
.stat-value { 
    font-size: 32px; 
    font-weight: 800; 
    background: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    text-align: center;
    display: block;
}
.stat-value-small { 
    font-size: 18px; 
    font-weight: 700; 
    background: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    text-align: center;
    display: block;
}

/* Value Card Specific */
.value-label {
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-align: center;
}
.value-amount {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    display: block;
    text-align: center;
}

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 15px; }
.stat-card {
    background: var(--card);
    border-radius: 16px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,0.03);
}
.stat-card .stat-value { font-size: 20px; background: none; -webkit-text-fill-color: var(--text); }
.stat-value.positive { color: var(--success) !important; }
.stat-value.negative { color: var(--danger) !important; }

/* Section Titles */
.section-title {
    font-size: 16px;
    font-weight: 700;
    margin: 20px 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.section-title span { color: var(--text-secondary); font-size: 12px; font-weight: 400; }

/* Stock Cards */
.stock-card {
    background: var(--card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.03);
    transition: all 0.3s ease;
}
.stock-card:hover { background: var(--card-hover); }

/* Slide to Delete Container */
.stock-item-container {
    position: relative;
    overflow: hidden;
    margin-bottom: 10px;
    border-radius: 16px;
}
.stock-actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1;
}
.stock-actions.revealed {
    transform: translateX(0);
}
.stock-card-content {
    background: var(--card);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}
.delete-btn {
    width: 70px;
    height: 100%;
    background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
    border: none;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
}
.stock-info { display: flex; align-items: center; gap: 14px; }
.stock-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
}
.stock-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.stock-qty { color: var(--text-secondary); font-size: 12px; }
.stock-price-info { text-align: right; }
.stock-price { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.stock-change { font-size: 12px; font-weight: 600; }
.stock-change.positive { color: var(--success); }
.stock-change.negative { color: var(--danger); }

/* Input & Buttons */
.input-group { display: flex; gap: 8px; flex-wrap: wrap; }
input {
    flex: 1;
    min-width: 70px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    background: rgba(255,255,255,0.08);
    color: var(--text);
    transition: all 0.3s ease;
}
input::placeholder { color: var(--text-secondary); }
input:focus { outline: none; background: rgba(255,255,255,0.12); }
button {
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}
button:active { transform: scale(0.96); }
button:hover { box-shadow: 0 8px 25px rgba(0, 135, 81, 0.3); }

/* Bottom Navigation */
.tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    padding: 10px 0 25px;
    border-top: 1px solid rgba(255,255,255,0.05);
    z-index: 100;
}
.tab {
    text-align: center;
    color: var(--text-secondary);
    font-size: 10px;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 12px;
    transition: all 0.3s ease;
}
.tab.active { color: var(--primary); background: rgba(0, 135, 81, 0.1); }
.tab-icon { font-size: 22px; display: block; margin-bottom: 4px; }

/* Sections */
.section { display: none; }
.section.active { display: block; }

/* Dividends */
.div-income { 
    color: var(--success); 
    font-size: 36px; 
    font-weight: 800; 
    display: block; 
    text-align: center; 
    margin: 15px 0; 
}
.div-annual { color: var(--accent); font-size: 13px; }
.div-yield { color: #ffd700; font-size: 14px; }
.paying-stocks { font-size: 20px; font-weight: 700; }

/* Market Stocks */
.news-source { font-size: 11px; color: var(--accent); margin-top: 5px; }

/* Market Stocks */
.market-stock-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--card);
    border-radius: 14px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.03);
    transition: all 0.2s ease;
}
.market-stock-item:active { background: var(--card-hover); }
.market-stock-info { flex: 1; }
.market-stock-symbol { font-weight: 700; font-size: 15px; }
.market-stock-name { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.market-stock-price { font-weight: 600; font-size: 15px; margin-right: 12px; }
.market-stock-alert { font-size: 18px; opacity: 0.6; }
.market-stock-alert.active { opacity: 1; }

/* Alert Modal */
.alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    margin-bottom: 8px;
}
.alert-item.triggered { background: rgba(0, 255, 136, 0.1); border: 1px solid var(--success); }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 200; justify-content: center; align-items: center; padding: 20px; }
.modal.active { display: flex; }
.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16162a 100%);
    border-radius: 24px;
    padding: 25px;
    width: 100%;
    max-width: 380px;
    border: 1px solid rgba(255,255,255,0.05);
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; text-align: center; }
.modal-btns { display: flex; gap: 10px; margin-top: 20px; }
.modal-btns button { flex: 1; }
.cancel-btn { background: rgba(255,255,255,0.1) !important; }
.cancel-btn:hover { background: rgba(255,255,255,0.15) !important; box-shadow: none !important; }

/* Utilities */
.empty-state { text-align: center; color: var(--text-secondary); padding: 40px 20px; font-size: 14px; }
.swipe-hint { text-align: center; color: #555; font-size: 11px; padding: 10px; font-style: italic; }

/* FAB */
.fab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    z-index: 50;
}
.fab:hover { transform: scale(1.1); }
.fab:active { transform: scale(0.95); }

/* Value Change Badge */
.value-change {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(0, 200, 83, 0.15);
    border-radius: 24px;
    color: var(--success);
    font-size: 15px;
    font-weight: 600;
    margin-top: 10px;
}

/* Chart Preview */
.chart-preview {
    background: var(--card);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.03);
}
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
#lineChart { width: 100%; height: 120px; display: block; border-radius: 8px; background: rgba(0,0,0,0.2); }

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}
.loading-overlay.active { display: flex; }
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 15px; color: var(--text-secondary); font-size: 14px; }

/* Error Toast */
.error-toast {
    position: fixed;
    bottom: 100px;
    left: 20px;
    right: 20px;
    background: var(--danger);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideUp 0.3s ease;
}
.error-toast.show { display: flex; }
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.error-toast .error-icon { font-size: 24px; }
.error-toast .error-message { flex: 1; font-size: 14px; font-weight: 500; }
.error-toast .error-close { background: none; border: none; color: white; font-size: 20px; cursor: pointer; opacity: 0.7; }
.error-toast .error-close:hover { opacity: 1; }

/* Success Toast */
.success-toast {
    position: fixed;
    bottom: 100px;
    left: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideUp 0.3s ease;
}
.success-toast.show { display: flex; }
.success-toast .success-icon { font-size: 24px; }
.success-toast .success-message { flex: 1; font-size: 14px; font-weight: 500; }

/* Input validation styling */
input.invalid { border-color: var(--danger) !important; animation: shake 0.3s ease; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
input:focus.invalid { border-color: var(--danger); }
