/* ============================================================
   MyVault – Dark Theme Stylesheet
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    min-height: 100vh;
}
a { color: #00d2ff; text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Layout ────────────────────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    width: 240px;
    background: #141428;
    border-right: 1px solid #1e1e3a;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .25s;
}
.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #1e1e3a;
}
.sidebar-header .logo { font-size: 24px; }
.sidebar-header h2 { font-size: 20px; color: #00d2ff; font-weight: 700; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 20px;
    color: #999;
    font-size: 14px;
    transition: all .15s;
}
.sidebar-nav a:hover { background: #1a1a36; color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: #1a1a36; color: #00d2ff; border-right: 3px solid #00d2ff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #1e1e3a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.user-label { color: #888; }
.logout-link { color: #ff6b6b; }
.logout-link:hover { color: #ff4444; }

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
}
.top-bar {
    padding: 16px 28px;
    background: #141428;
    border-bottom: 1px solid #1e1e3a;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-title { font-size: 18px; font-weight: 600; }
.menu-toggle {
    display: none;
    background: none; border: none; color: #fff; font-size: 22px; cursor: pointer;
}
.content-area { padding: 28px; flex: 1; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: #181830;
    border: 1px solid #1e1e3a;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.card-header h3 { font-size: 16px; font-weight: 600; }

/* ── Stat Cards (Dashboard / Expenses) ─────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #181830;
    border: 1px solid #1e1e3a;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #00d2ff;
    margin-bottom: 4px;
}
.stat-card .stat-label { font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: 1px; }

.stat-card.green .stat-value { color: #00e676; }
.stat-card.orange .stat-value { color: #ff9800; }
.stat-card.red .stat-value { color: #ff5252; }
.stat-card.purple .stat-value { color: #b388ff; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #888;
    border-bottom: 1px solid #1e1e3a;
    white-space: nowrap;
}
tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #111125;
    font-size: 13px;
    vertical-align: middle;
}
tbody tr:hover { background: #1a1a36; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
}
.btn-primary { background: #00d2ff; color: #0f0f1a; }
.btn-primary:hover { background: #00b8d4; }
.btn-secondary { background: #2a2a4a; color: #ccc; }
.btn-secondary:hover { background: #333360; }
.btn-danger { background: #ff5252; color: #fff; }
.btn-danger:hover { background: #e04040; }
.btn-success { background: #00c853; color: #fff; }
.btn-success:hover { background: #00a040; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
    width: 30px; height: 30px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; font-size: 14px;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    background: #0f0f1a;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #e0e0e0;
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: #00d2ff; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 60px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.input-group {
    display: flex;
}
.input-group .form-control { border-radius: 6px 0 0 6px; }
.input-group .btn { border-radius: 0 6px 6px 0; }

/* ── Toolbar ───────────────────────────────────────────────── */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; }
.search-input {
    padding: 8px 12px;
    background: #0f0f1a;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #e0e0e0;
    width: 240px;
}
.search-input:focus { outline: none; border-color: #00d2ff; }
.filter-select {
    padding: 8px 12px;
    background: #0f0f1a;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #e0e0e0;
    cursor: pointer;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.show { display: flex; }
.modal-dialog {
    background: #1c1c38;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    width: 560px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.modal-sm .modal-dialog,
.modal-sm.modal .modal-dialog { width: 400px; }
.modal.modal-sm .modal-dialog { width: 400px; }
/* Also handle .modal-sm directly on dialog */
.modal-dialog.modal-sm { width: 400px; }

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #2a2a4a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none; border: none; color: #888; font-size: 22px; cursor: pointer;
    padding: 0; line-height: 1;
}
.modal-close:hover { color: #fff; }
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #2a2a4a;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-active { background: #00c85333; color: #00c853; }
.badge-paused { background: #ff980033; color: #ff9800; }
.badge-cancelled { background: #ff525233; color: #ff5252; }
.badge-yes { background: #00d2ff22; color: #00d2ff; }
.badge-no { background: #44444433; color: #888; }

/* ── Masked Text ───────────────────────────────────────────── */
.masked { font-family: monospace; letter-spacing: 2px; }
.sensitive-field { font-family: monospace; }
.toggle-vis { cursor: pointer; user-select: none; font-size: 16px; }

/* ── Toast Notification ────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 2000;
    display: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    max-width: 380px;
}
.toast.show { display: block; animation: slideIn .25s ease; }
.toast.success { background: #00c853; color: #fff; }
.toast.error { background: #ff5252; color: #fff; }
.toast.info { background: #00d2ff; color: #0f0f1a; }
@keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ── Expenses Category Bar ─────────────────────────────────── */
.category-bar {
    margin-bottom: 8px;
}
.category-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
    color: #ccc;
}
.category-bar-track {
    height: 8px;
    background: #0f0f1a;
    border-radius: 4px;
    overflow: hidden;
}
.category-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: #00d2ff;
    transition: width .4s ease;
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Login Page ────────────────────────────────────────────── */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #0f0f1a;
}
.login-box {
    background: #181830;
    border: 1px solid #1e1e3a;
    padding: 40px;
    border-radius: 12px;
    width: 380px;
    max-width: 95vw;
}
.login-box h1 { text-align: center; color: #00d2ff; margin-bottom: 8px; font-size: 28px; }
.login-box .sub { text-align: center; color: #666; margin-bottom: 28px; font-size: 13px; }
.login-box .form-group { margin-bottom: 18px; }
.login-box .btn { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.login-error { background: #ff525233; color: #ff5252; padding: 10px; border-radius: 6px; margin-bottom: 16px; text-align: center; font-size: 13px; display: none; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-input { width: 100%; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0f0f1a; }
::-webkit-scrollbar-thumb { background: #2a2a4a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a5a; }

/* ── View Details ──────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
    font-size: 13px;
}
.detail-label { color: #888; font-weight: 500; }
.detail-value { color: #e0e0e0; word-break: break-all; }
.detail-value a { color: #00d2ff; }
