/* ============================================================
   USAIDIZI SAVING GROUP - Main Stylesheet
   ============================================================ */

:root {
    --primary:     #1a5276;
    --primary-dark:#154360;
    --accent:      #f39c12;
    --accent-dark: #d68910;
    --success:     #1e8449;
    --danger:      #c0392b;
    --warning:     #d35400;
    --light-bg:    #f0f4f8;
    --sidebar-w:   250px;
    --white:       #ffffff;
    --text:        #2c3e50;
    --muted:       #7f8c8d;
    --border:      #dee2e6;
    --card-shadow: 0 2px 12px rgba(0,0,0,.08);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- LOGIN PAGE ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 60%, #0a2a45 100%);
    padding: 20px;
}
.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo .logo-circle {
    width: 170px; height: 170px;
    background: transparent;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 36px; color: #fff; margin-bottom: 12px;
    overflow: hidden;
    padding: 0;
}
.login-brand-logo {
    display: block;
    width: 145%;
    height: 145%;
    max-width: none;
    max-height: none;
    object-fit: contain;
    border-radius: 50%;
    transform: translateY(8%);
}
.login-logo h1 { font-size: 22px; color: var(--primary); font-weight: 700; }
.login-logo p  { color: var(--muted); font-size: 13px; }

/* ---- LAYOUT ---- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s ease;
}
.sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    text-align: center;
}
.sidebar-brand .brand-icon {
    width: 128px; height: 128px;
    background: transparent;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px; margin-bottom: 8px;
    overflow: hidden;
}
.brand-logo {
    display: block;
    width: 145%;
    height: 145%;
    max-width: none;
    max-height: none;
    object-fit: contain;
    border-radius: 50%;
    transform: translateY(8%);
}
.sidebar-brand h2 { font-size: 15px; font-weight: 700; line-height: 1.3; }
.sidebar-brand small { font-size: 11px; opacity: .7; }

.sidebar-user {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; gap: 10px;
}
.sidebar-user img {
    width: 52px; height: 48px;
    flex-shrink: 0;
    border-radius: 6px;
    object-fit: contain;
    background: rgba(255,255,255,.12);
    border: none;
}
.sidebar-user .user-info .name { font-size: 13px; font-weight: 600; }
.sidebar-user .user-info .role {
    font-size: 11px; opacity: .7;
    background: rgba(255,255,255,.15);
    padding: 1px 8px; border-radius: 10px;
}

.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar-nav .nav-section {
    font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
    opacity: .5; padding: 14px 20px 4px;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: rgba(255,255,255,.85);
    font-size: 13.5px; transition: all .2s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,.12);
    color: #fff; text-decoration: none;
    border-left: 3px solid var(--accent);
    padding-left: 17px;
}
.sidebar-nav a .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer a {
    color: rgba(255,255,255,.7); font-size: 13px;
    display: flex; align-items: center; gap: 8px;
}
.sidebar-footer a:hover { color: #fff; text-decoration: none; }

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

.topbar {
    background: var(--white);
    padding: 12px 28px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar .page-title { font-size: 18px; font-weight: 700; color: var(--primary); }
.topbar .topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar .topbar-right .date-display { color: var(--muted); font-size: 13px; }

.content-body { padding: 28px; flex: 1; }

/* ---- STATS CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: var(--card-shadow);
    display: flex; align-items: center; gap: 16px;
    border-left: 4px solid var(--primary);
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.stat-card.green  { border-left-color: var(--success); }
.stat-card.orange { border-left-color: var(--accent); }
.stat-card.red    { border-left-color: var(--danger); }
.stat-card.blue   { border-left-color: #2980b9; }
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; flex-shrink: 0;
}
.stat-card.green  .stat-icon { background: #d5f5e3; }
.stat-card.orange .stat-icon { background: #fdebd0; }
.stat-card.red    .stat-icon { background: #fadbd8; }
.stat-card.blue   .stat-icon { background: #d6eaf8; }
.stat-card        .stat-icon { background: #d6eaf8; }
.stat-info .value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-info .label { font-size: 12px; color: var(--muted); }

/* ---- CARDS ---- */
.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
    overflow: hidden;
}
.card-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: #fafbfc;
}
.card-header h3 { font-size: 15px; font-weight: 700; color: var(--primary); }
.card-body { padding: 22px; }

/* ---- TABLES ---- */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
    background: var(--primary);
    color: #fff;
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:hover { background: #f8fbff; }
tbody td { padding: 10px 14px; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.badge-success { background: #d5f5e3; color: #1e8449; }
.badge-danger  { background: #fadbd8; color: #c0392b; }
.badge-warning { background: #fef9e7; color: #d35400; }
.badge-info    { background: #d6eaf8; color: #1a5276; }
.badge-secondary { background: #eaecee; color: #566573; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; color: var(--text); }
.form-control {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px; color: var(--text);
    background: var(--white);
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,82,118,.12);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border: none; border-radius: 8px;
    font-size: 13.5px; font-weight: 600; cursor: pointer;
    transition: all .2s; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: .88; transform: translateY(-1px); }
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-warning  { background: var(--accent);   color: #fff; }
.btn-secondary{ background: #95a5a6;         color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

/* ---- ALERTS ---- */
.alert {
    padding: 12px 18px; border-radius: 8px;
    margin-bottom: 18px; font-size: 13.5px;
    display: flex; align-items: center; gap: 10px;
    border-left: 4px solid;
}
.alert-success { background: #d5f5e3; color: #1a6b3a; border-color: var(--success); }
.alert-danger  { background: #fadbd8; color: #922b21; border-color: var(--danger); }
.alert-warning { background: #fef9e7; color: #9a5e0a; border-color: var(--accent); }
.alert-info    { background: #d6eaf8; color: #154360; border-color: var(--primary); }

/* ---- PROFILE PHOTO ---- */
.profile-photo-wrap {
    display: flex; flex-direction: column; align-items: center;
    gap: 10px; margin-bottom: 10px;
}
.profile-photo-wrap img {
    width: 200px; height: 180px;
    max-width: 100%;
    border-radius: 10px;
    object-fit: contain;
    background: #f4f6f7;
    border: none;
    box-shadow: none;
}
.member-avatar {
    width: 48px; height: 38px;
    max-width: 100%;
    border-radius: 5px;
    object-fit: contain;
    background: #f4f6f7;
    border: none;
}

/* ---- PROFILE PAGE LAYOUT ---- */
.profile-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .profile-photo-wrap img {
        width: 180px;
        height: 160px;
    }
}

/* Account info responsive grid */
.account-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    font-size: 13.5px;
}

@media (max-width: 480px) {
    .account-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 16px; }
.pagination a, .pagination span {
    padding: 6px 12px; border-radius: 6px; font-size: 13px;
    border: 1px solid var(--border); color: var(--primary);
    transition: all .15s;
}
.pagination a:hover { background: var(--primary); color: #fff; text-decoration: none; }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- MISC ---- */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning{ color: var(--warning); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap    { display: flex; align-items: center; gap: 10px; }
.w-100       { width: 100%; }
hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ---- MOBILE ---- */
.hamburger {
    display: none; background: none; border: none;
    font-size: 22px; cursor: pointer; color: var(--primary);
}
@media (max-width: 768px) {
    .hamburger { display: block; }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .content-body { padding: 16px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 28px 20px; }
    .login-logo .logo-circle { width: 120px; height: 120px; }
    .sidebar-brand .brand-icon { width: 88px; height: 88px; }
}

/* ---- PROGRESS BAR ---- */
.progress-bar-wrap {
    background: #e9ecef;
    border-radius: 20px;
    height: 10px;
    overflow: hidden;
    margin-top: 4px;
}
.progress-bar {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--success), #2ecc71);
    transition: width .4s;
}
.progress-bar.warn { background: linear-gradient(90deg, var(--accent), #f1c40f); }
.progress-bar.danger { background: linear-gradient(90deg, var(--danger), #e74c3c); }

/* ---- FOOTER ---- */
.app-footer {
    text-align: center; padding: 14px;
    color: var(--muted); font-size: 12px;
    border-top: 1px solid var(--border);
    background: var(--white);
}
