/* =====================
   CreditUp Portal CSS
   ===================== */

:root {
    --bg:        #0a0e1a;
    --bg2:       #111827;
    --bg3:       #1a2235;
    --border:    #1e2d45;
    --accent:    #00d4aa;
    --accent2:   #0099ff;
    --warn:      #f59e0b;
    --danger:    #ef4444;
    --text:      #e2e8f0;
    --text-muted:#6b7e99;
    --sidebar-w: 240px;
    --radius:    12px;
}

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

body {
    font-family: 'Sora', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.logo-icon { font-size: 22px; color: var(--accent); }
.logo-text  { font-size: 18px; font-weight: 700; letter-spacing: .5px; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: #000; flex-shrink: 0;
}
.user-name  { font-size: 13px; font-weight: 600; }
.user-email { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 155px; }

.sidebar-nav { flex: 1; padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: all .2s;
    position: relative;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(0,212,170,.12); color: var(--accent); }
.nav-icon { font-size: 16px; width: 18px; text-align: center; }
.badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.logout-btn {
    margin: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(239,68,68,.1);
    color: var(--danger);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: background .2s;
}
.logout-btn:hover { background: rgba(239,68,68,.2); }

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-title    { font-size: 18px; font-weight: 700; }
.topbar-date   { font-size: 12px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

.content-body { padding: 28px 32px; }

/* ---- CARDS ---- */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

/* ---- STAT CARDS ROW ---- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
}
.stat-card.blue::before  { background: var(--accent2); }
.stat-card.warn::before  { background: var(--warn); }
.stat-card.danger::before{ background: var(--danger); }

.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.stat-sub   { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-green { color: var(--accent); }
.stat-blue  { color: var(--accent2); }
.stat-warn  { color: var(--warn); }

/* ---- SCORE RING ---- */
.score-section { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.score-ring-wrap { position: relative; width: 130px; height: 130px; flex-shrink: 0; }
.score-ring-wrap svg { transform: rotate(-90deg); }
.score-ring-center {
    position: absolute;
    inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.score-ring-num  { font-size: 26px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--accent); }
.score-ring-label{ font-size: 10px; color: var(--text-muted); }
.score-meta h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.score-meta p  { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }

/* ---- HISTORY TABLE ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { text-align: left; padding: 10px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 600; }
tbody td { padding: 12px 14px; border-bottom: 1px solid rgba(30,45,69,.5); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg3); }

/* ---- STATUS BADGES ---- */
.status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.status-completed { background: rgba(0,212,170,.15); color: var(--accent); }
.status-progress  { background: rgba(0,153,255,.15); color: var(--accent2); }
.status-pending   { background: rgba(245,158,11,.15); color: var(--warn); }
.status-paid      { background: rgba(0,212,170,.15); color: var(--accent); }
.status-open      { background: rgba(245,158,11,.15); color: var(--warn); }
.status-closed    { background: rgba(107,126,153,.15); color: var(--text-muted); }
.status-active    { background: rgba(0,212,170,.15); color: var(--accent); }
.status-expired   { background: rgba(239,68,68,.15); color: var(--danger); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: 'Sora', sans-serif;
    transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
select.form-control option { background: var(--bg2); }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all .2s;
    font-family: 'Sora', sans-serif;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #00bfa0; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.alert-success { background: rgba(0,212,170,.12); color: var(--accent); border: 1px solid rgba(0,212,170,.2); }
.alert-danger   { background: rgba(239,68,68,.12); color: var(--danger); border: 1px solid rgba(239,68,68,.2); }

/* ---- PLAN CARD ---- */
.plan-card {
    background: linear-gradient(135deg, rgba(0,212,170,.08), rgba(0,153,255,.08));
    border: 1px solid rgba(0,212,170,.25);
    border-radius: var(--radius);
    padding: 24px;
}
.plan-name  { font-size: 22px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.plan-dates { font-size: 12px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; margin-bottom: 16px; }
.plan-detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.plan-detail-row:last-child { border-bottom: none; }

/* ---- PROGRESS BAR ---- */
.progress-bar-wrap { background: var(--bg3); border-radius: 20px; height: 8px; overflow: hidden; margin-top: 4px; }
.progress-bar-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .6s ease; }

/* ---- NOTIFICATION ITEM ---- */
.notif-item {
    display: flex; gap: 14px; padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.notif-dot.read { background: var(--text-muted); }
.notif-text  { font-size: 13.5px; }
.notif-time  { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ---- UPLOAD AREA ---- */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s;
}
.upload-area:hover { border-color: var(--accent); }
.upload-area input[type=file] { display: none; }
.upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-text { font-size: 13px; color: var(--text-muted); }

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}
.login-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 32px; color: var(--accent); display: block; }
.login-logo h2 { font-size: 22px; font-weight: 700; margin-top: 6px; }
.login-logo p  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---- TICKET ---- */
.ticket-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.ticket-item:last-child { border-bottom: none; }
.ticket-subject { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.ticket-msg { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

/* ---- SCORE COLOR ---- */
.score-poor   { color: #ef4444; }
.score-fair   { color: #f59e0b; }
.score-good   { color: #3b82f6; }
.score-great  { color: var(--accent); }
.score-excel  { color: #a855f7; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .logo-text, .sidebar .user-info, .sidebar .nav-item span:not(.nav-icon), .sidebar .logout-btn { display: none; }
    .sidebar-user { justify-content: center; }
    .main-content { margin-left: 60px; }
    .content-body { padding: 16px; }
}

/* ---- TOPBAR EXTRAS ---- */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Bell icon */
.topbar-icon-btn {
    position: relative;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    font-size: 15px;
    transition: background .2s;
}
.topbar-icon-btn:hover { background: var(--border); }
.bell-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg2);
}

/* User dropdown trigger */
.topbar-user-wrap { position: relative; }

.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 40px;
    cursor: pointer;
    color: var(--text);
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: background .2s, border-color .2s;
}
.topbar-user-btn:hover { background: var(--border); border-color: var(--accent); }

.topbar-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px; color: #000;
    flex-shrink: 0;
}
.topbar-username { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop-arrow { font-size: 10px; color: var(--text-muted); }

/* Dropdown panel */
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 210px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0,0,0,.5);
    z-index: 999;
    overflow: hidden;
    animation: dropIn .15s ease;
}
.user-dropdown.open { display: block; }

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.user-drop-info {
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
}
.udrop-name  { font-size: 13px; font-weight: 600; }
.udrop-email { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.user-drop-item {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    transition: background .15s;
}
.user-drop-item:hover { background: var(--bg3); }

.user-drop-divider { height: 1px; background: var(--border); margin: 4px 0; }

.user-drop-logout { color: var(--danger) !important; font-weight: 600; }
.user-drop-logout:hover { background: rgba(239,68,68,.1) !important; }
