/* css/style.css */

/* Reset / base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --brand-bg: #c13584;
    --brand-ink: #6327af;
    --card-bg: #ffffff;
    --muted: #6b6b6b;
    --success: #28a745;
    --danger: #dc3545;
    --shadow-1: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-2: 0 6px 18px rgba(0, 0, 0, 0.04);
}

/* Body and global */
html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #ffffff;
    color: var(--brand-ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-y: auto;
    line-height: 1.4;
}

/* LOGIN */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 28px;
}

.login-box {
    max-width: 520px;
    width: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.99));
    border-radius: 14px;
    box-shadow: var(--shadow-1);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr;
}

.login-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.logo-wrap {
    width: 88px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

.logo-img {
    max-width: 86px;
    max-height: 54px;
    object-fit: contain;
    display: block;
}

.login-header-text h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-ink);
}

.login-header-text p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}

.login-form {
    padding: 22px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--brand-ink);
    margin-bottom: 8px;
    font-size: 13px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
    font-size: 14px;
    color: var(--brand-ink);
    transition: box-shadow .14s, border-color .14s;
}

.form-group input:focus {
    outline: none;
    border-color: rgba(99, 39, 175, 0.85);
    box-shadow: 0 6px 16px rgba(99, 39, 175, 0.06);
}

.password-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 20px;
    color: var(--muted);
    user-select: none;
}

.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--brand-ink);
    font-weight: 500;
}

.login-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    background: linear-gradient(90deg, var(--brand-ink) 0%, #4a1990 100%);
    color: #fff;
    box-shadow: 0 10px 30px rgba(99, 39, 175, 0.12);
    transition: transform .12s, box-shadow .12s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(99, 39, 175, 0.14);
}

.error-message {
    background: #fff6f7;
    color: var(--danger);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 12px;
    display: none;
}

/* DASHBOARD VISIBILITY REMOVED: Since we are splitting files, we don't need to hide/show sections via CSS classes anymore. We display the body normally. */

/* SIDEBAR (LEFT) */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    padding: 22px 18px;
    background: var(--brand-bg);
    color: #fff;
    z-index: 60;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    margin-bottom: 8px;
}

.sidebar-logo h2 {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 14px 0;
}

.nav-menu {
    list-style: none;
    padding: 6px 0;
    margin: 0;
    flex: 1;
}

.nav-item {
    margin: 8px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: background .12s, transform .08s;
}

.nav-link:hover {
    transform: translateY(-2px);
    background: rgba(0, 0, 0, 0.06);
    color: #fff;
}

.nav-link.active {
    background: rgba(0, 0, 0, 0.10);
    color: #fff;
}

.nav-icon {
    font-size: 20px;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar .footer-space {
    margin-top: auto;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

/* MAIN CONTENT (RIGHT) */
.main-content {
    margin-left: 250px;
    padding: 28px 32px;
    min-height: 100vh;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.container-constrain {
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.top-bar {
    background: var(--card-bg);
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar h1 {
    color: var(--brand-ink);
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(90deg, #7a21c6, #50108f);
    font-weight: 700;
}

.logout-btn {
    padding: 8px 12px;
    border-radius: 8px;
    background: #d9534f;
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 700;
}

.logout-btn:hover {
    background: #c9302c;
}

/* Components */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin: 0 auto;
    max-width: 1180px;
    width: 100%;
}

.stat-card {
    background: var(--card-bg);
    padding: 18px;
    border-radius: 12px;
    box-shadow: var(--shadow-2);
    border-left: 6px solid rgba(99, 39, 175, 0.12);
}

.stat-card h3 {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
    font-weight: 700;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--brand-ink);
    margin-bottom: 6px;
}

.stat-change {
    font-size: 12px;
    color: var(--success);
}

.content-section {
    background: var(--card-bg);
    padding: 18px;
    border-radius: 12px;
    box-shadow: var(--shadow-2);
    margin: 0 auto;
    max-width: 1180px;
    width: 100%;
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.section-header h2 {
    color: var(--brand-ink);
    font-size: 18px;
    margin: 0;
}

.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    text-align: left;
    padding: 12px;
    background: #fafafa;
    font-weight: 700;
    color: var(--muted);
    border-bottom: 1px solid #eee;
}

tbody td {
    padding: 12px;
    border-bottom: 1px solid #f2f2f2;
    color: var(--brand-ink);
    vertical-align: middle;
}

.badge {
    padding: 6px 12px;
    border-radius: 18px;
    font-weight: 700;
    font-size: 12px;
    display: inline-block;
}

.badge-gold {
    background: linear-gradient(90deg, rgba(193, 149, 72, 0.16), rgba(212, 175, 55, 0.06));
    color: #7b5b2b;
}

.badge-platinum {
    background: #efefef;
    color: #6b6b6b;
}

.badge-silver {
    background: #f2f2f2;
    color: #6b6b6b;
}

.btn {
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 700;
}

.btn-primary {
    background: linear-gradient(90deg, var(--brand-ink), #4a1990);
    color: #fff;
    box-shadow: 0 8px 20px rgba(99, 39, 175, 0.10);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.form-control {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    width: 100%;
}

/* Responsive */
@media (max-width: 1100px) {

    .container-constrain,
    .top-bar,
    .content-section,
    .stats-grid {
        max-width: 92%;
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        display: flex;
        flex-direction: row;
        gap: 12px;
        align-items: center;
        padding: 12px;
    }

    .sidebar-logo h2 {
        display: none;
    }

    .nav-link {
        padding: 10px 10px;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .top-bar,
    .content-section,
    .stats-grid {
        max-width: 100%;
        margin: 0;
    }
}

a:focus,
button:focus,
input:focus {
    outline: 3px solid rgba(99, 39, 175, 0.12);
    outline-offset: 2px;
}


/* --- MODAL STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: #fff;
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.modal-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { margin: 0; font-size: 16px; color: var(--brand-ink); }
.close-icon { cursor: pointer; color: var(--muted); }
.close-icon:hover { color: var(--danger); }

.modal-body { padding: 20px; }

.form-group-row {
    display: grid;
    grid-template-columns: 120px 1fr 100px; /* Label, Rate, Change */
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}
.form-group-row label { font-size: 14px; font-weight: 600; color: var(--muted); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}