/* CredStack – Main Stylesheet */
:root {
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #6366f1;
    --sidebar-hover: #1e293b;
    --topbar-bg: #ffffff;
    --topbar-shadow: 0 1px 3px rgba(0,0,0,.08);
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --radius: 12px;
    --transition: all .2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--body-bg); color: var(--text); font-size: .9375rem; }

/* ─── Sidebar ─────────────────────────────── */
.wrapper { min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1000;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .5px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
}
.sidebar-brand i { color: var(--primary); font-size: 1.4rem; }

.sidebar-nav { padding: 1rem 0; }
.nav-divider {
    padding: .5rem 1.25rem;
    margin-top: .5rem;
}
.nav-divider span {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #475569;
}

.sidebar-nav .nav-item > a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0;
    transition: var(--transition);
    font-size: .9rem;
    position: relative;
}
.sidebar-nav .nav-item > a i { width: 18px; text-align: center; }
.sidebar-nav .nav-item > a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-item.active > a {
    background: linear-gradient(135deg, rgba(99,102,241,.2), rgba(99,102,241,.05));
    color: #fff;
    border-right: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #1e293b;
}
.btn-logout {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: .875rem;
    padding: .5rem 0;
    transition: var(--transition);
}
.btn-logout:hover { color: var(--danger); }

/* ─── Topbar ──────────────────────────────── */
.topbar {
    background: var(--topbar-bg);
    padding: .75rem 1.5rem;
    box-shadow: var(--topbar-shadow);
    position: sticky;
    top: 0;
    z-index: 900;
    border-bottom: 1px solid var(--border);
}
.sidebar-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .35rem .6rem;
    color: var(--text-muted);
    cursor: pointer;
}
.sidebar-toggle:hover { background: var(--body-bg); }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
}
.user-name { font-weight: 600; font-size: .875rem; line-height: 1.2; }

.badge-role { font-size: .65rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.badge-admin { background: rgba(99,102,241,.15); color: var(--primary); }
.badge-user  { background: rgba(16,185,129,.15); color: var(--accent); }

/* ─── Page Content ────────────────────────── */
.main-content { min-width: 0; }
.page-content { padding: 1.75rem; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.page-header h1 i { color: var(--primary); }

.page-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .8rem;
    background: var(--topbar-bg);
}

/* ─── Cards ───────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card-header-custom {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}
.card-header-custom h5 {
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
    color: var(--text);
}

/* ─── Stat Cards ──────────────────────────── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon.purple { background: rgba(99,102,241,.12); color: var(--primary); }
.stat-icon.green  { background: rgba(16,185,129,.12);  color: var(--accent); }
.stat-icon.orange { background: rgba(245,158,11,.12);  color: var(--warning); }
.stat-icon.red    { background: rgba(239,68,68,.12);   color: var(--danger); }

.stat-num { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

/* ─── Tables ──────────────────────────────── */
.table-responsive { border-radius: var(--radius); overflow: hidden; }
.table { margin: 0; }
.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: .75rem 1rem;
    white-space: nowrap;
}
.table tbody td { padding: .75rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--border); font-size: .875rem; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }

/* ─── Buttons ─────────────────────────────── */
.btn-primary-cs {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .5rem 1.1rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    text-decoration: none;
}
.btn-primary-cs:hover { background: var(--primary-dark); color: #fff; }

.btn-sm-icon {
    width: 30px; height: 30px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-muted);
}
.btn-sm-icon:hover { color: var(--primary); border-color: var(--primary); background: rgba(99,102,241,.05); }
.btn-sm-icon.danger:hover { color: var(--danger); border-color: var(--danger); background: rgba(239,68,68,.05); }

/* ─── Forms ───────────────────────────────── */
.form-label { font-weight: 600; font-size: .875rem; color: var(--text); margin-bottom: .3rem; }
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: .55rem .85rem;
    font-size: .9rem;
    transition: var(--transition);
    background: #fff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
    outline: none;
}
.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { font-size: .8rem; color: var(--danger); margin-top: .25rem; }

.input-group .btn { border-radius: 0 8px 8px 0; }

/* Password input with toggle */
.password-wrapper { position: relative; }
.password-wrapper .form-control { padding-right: 2.75rem; }
.password-toggle {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 2.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.password-toggle:hover { color: var(--primary); }

/* ─── Alerts ──────────────────────────────── */
.alert-cs {
    padding: .75rem 1rem;
    border-radius: 8px;
    font-size: .875rem;
    border: 1px solid transparent;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}
.alert-cs.success { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.3); color: #065f46; }
.alert-cs.error   { background: rgba(239,68,68,.08);  border-color: rgba(239,68,68,.3);  color: #991b1b; }
.alert-cs.warning { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.3); color: #92400e; }
.alert-cs.info    { background: rgba(99,102,241,.08); border-color: rgba(99,102,241,.3); color: #3730a3; }

/* ─── Auth Pages ──────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    padding: 1rem;
}
.auth-card {
    background: #fff;
    border-radius: 18px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,.3);
}
.auth-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}
.auth-logo .logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: .75rem;
}
.auth-logo h2 { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.auth-logo p  { color: var(--text-muted); font-size: .875rem; }

.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .875rem; }
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* ─── Badge status ────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
}
.status-badge.active   { background: rgba(16,185,129,.12); color: #065f46; }
.status-badge.inactive { background: rgba(239,68,68,.12);  color: #991b1b; }

/* ─── Masked cred ─────────────────────────── */
.cred-masked { letter-spacing: 3px; color: var(--text-muted); }
.cred-reveal-btn { background: none; border: none; cursor: pointer; color: var(--primary); font-size: .8rem; padding: 0 .25rem; text-decoration: underline; }

/* ─── Breadcrumb ──────────────────────────── */
.breadcrumb { font-size: .8rem; margin-bottom: 1rem; }
.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-muted); }

/* ─── Empty State ─────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state h5 { font-size: 1.1rem; font-weight: 700; color: var(--text); }

/* ─── Responsive ──────────────────────────── */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: -260px; }
    .sidebar.open { left: 0; }
    .page-content { padding: 1rem; }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; }
    .sidebar-overlay.show { display: block; }
}

/* ─── Scrollbar ───────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
