/* Stock Club Styles */

:root {
    --bg: #0f0f13;
    --bg-card: #1a1a24;
    --bg-input: #23232f;
    --bg-hover: #2a2a38;
    --border: #2e2e3e;
    --text: #e4e4ed;
    --text-muted: #8888a0;
    --accent: #00d4aa;
    --accent-hover: #00f0c0;
    --red: #ff4d6a;
    --green: #00d4aa;
    --orange: #ffa057;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* Loading */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
    color: var(--text-muted);
}
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Layout */
.page { display: none; max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.page.active { display: block; }

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.header h1 { font-size: 1.3rem; font-weight: 600; }
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--text-muted); font-size: 0.9rem; }

/* Buttons */
button, .btn {
    background: var(--accent);
    color: #0f0f13;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button:disabled, .btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary { background: var(--bg-input); color: var(--text); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { opacity: 0.85; background: var(--red); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg-input); border-color: var(--accent); color: var(--accent); }

/* Forms */
input, select, textarea {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    width: 100%;
    outline: none;
    transition: border-color .2s;
}
input:focus, select:focus { border-color: var(--accent); }
label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }
.form-group { margin-bottom: 16px; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.card-title { font-weight: 600; margin-bottom: 12px; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.5rem; margin-bottom: 8px; }
.login-card p { color: var(--text-muted); margin-bottom: 24px; }
.login-error { color: var(--red); font-size: 0.85rem; margin-bottom: 12px; display: none; }
.login-error.show { display: block; }

/* Totals bar */
.totals-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.total-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.total-card .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.total-card .value { font-size: 1.4rem; font-weight: 700; margin-top: 4px; }
.total-card .value.positive { color: var(--green); }
.total-card .value.negative { color: var(--red); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--text-muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover { background: var(--bg-hover); }
.price { font-family: 'SF Mono', 'Fira Code', monospace; text-align: right; }
.price.up { color: var(--green); }
.price.down { color: var(--red); }

/* Diff display */
.diff-added { border-left: 3px solid var(--green); }
.diff-removed { border-left: 3px solid var(--red); }
.diff-changed { border-left: 3px solid var(--orange); }
.badge-added { background: rgba(0,212,170,0.15); color: var(--green); padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; }
.badge-removed { background: rgba(255,77,106,0.15); color: var(--red); padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; }
.badge-changed { background: rgba(255,160,87,0.15); color: var(--orange); padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; }

/* Upload area */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: rgba(0,212,170,0.05); }
.upload-zone p { color: var(--text-muted); margin-top: 8px; }

/* Toast notifications */
.toast {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
    box-shadow: var(--shadow);
    animation: slideUp .3s ease;
    max-width: 400px;
    z-index: 100;
}
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* History chart placeholder */
.chart-placeholder {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Value history chart */
#value-chart { margin-bottom: 24px; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    align-items: center; justify-content: center;
    z-index: 200;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.modal h2 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 18px; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent; font-size: 0.9rem; font-weight: 500; transition: color .2s, border-color .2s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Ownership table editable */
.editable-quantity {
    background: transparent;
    border: 1px solid transparent;
    width: 80px;
    text-align: right;
    padding: 4px 8px;
    border-radius: 4px;
}
.editable-quantity:focus { border-color: var(--accent); background: var(--bg-input); }
.edit-actions { display: flex; gap: 4px; }

/* Misc */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
