@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,500;0,700;0,800;0,900;1,400&family=Oswald:wght@500;600;700&display=swap');

:root {
    --ink: #0d1e35;
    --wine: #2a528a;
    --red: #17345d;
    --gold: #3a7bd5;
    --paper: #f0f7ff;
    --border-color: rgba(23, 52, 93, .3);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Be Vietnam Pro', sans-serif;
    color: var(--ink);
    background: linear-gradient(180deg, #f0f7ff, #e1ebfa) fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

/* Header / Topbar */
.id-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    min-height: 72px;
    background: #17345d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
}

.topbar-inner {
    max-width: 1050px;
    height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-logo img {
    width: 86px;
    display: block;
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-title {
    display: block;
    font-family: 'Oswald', sans-serif;
    font-size: 22px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffffff;
    position: relative;
}

.brand-title::after {
    content: "Kiếm Hiệp Truyền Kỳ";
    display: block;
    font-family: 'Be Vietnam Pro', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: none;
    margin-top: -2px;
    opacity: 0.8;
}

.user-welcome {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
}

.user-welcome i {
    color: var(--red);
    font-size: 14px;
}

.account-balance {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--wine);
    font-weight: 700;
    font-size: 15px;
    padding: 6px 16px;
    background: rgba(245, 252, 255, 0.6);
    border-radius: 20px;
    border: 1px solid rgba(202, 145, 62, 0.2);
}

.account-balance i {
    color: #3498db;
}

.topbar-nav {
    display: flex;
    gap: 8px;
}

.topbar-nav a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: #ffffff;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.topbar-nav a:hover {
    background: #ffffff;
    color: #17345d;
    border-color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Main Layout */
.container {
    width: min(1050px, calc(100% - 32px));
    margin: 88px auto 40px;
    padding: 0;
    flex: 1;
}

.container.has-sidebar {
    background: rgba(245, 250, 255, .94);
    border: 1px solid rgba(23, 52, 93, .46);
    box-shadow: 0 18px 42px rgba(23, 52, 93, .13);
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 600px;
    padding: 0;
}

/* Sidebar */
.sidebar {
    background: rgba(235, 245, 255, .55);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

.sidebar-user-section {
    padding: 24px 18px;
    background: rgba(255, 255, 255, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-welcome {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 15px;
    font-size: 15px;
}

.sidebar-welcome i {
    font-size: 20px;
    color: var(--red);
}

.sidebar-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.sidebar-balance .label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--wine);
    text-transform: uppercase;
}

.sidebar-balance .amount {
    color: var(--red);
    font-family: 'Oswald', sans-serif;
    font-size: 18px;
    letter-spacing: 0.5px;
}

.sidebar-menu-group {
    padding: 15px 0 5px;
}

.sidebar-menu-header {
    padding: 0 18px 8px;
    font-size: 11px;
    font-weight: 800;
    color: rgba(23, 52, 93, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 18px;
    color: #1e447a;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid rgba(23, 52, 93, 0.05);
}

.sidebar-menu a i {
    width: 22px;
    margin-right: 12px;
    color: var(--wine);
    font-size: 14px;
    opacity: 0.8;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    color: var(--red);
    background: rgba(218, 154, 50, .1);
}

.sidebar-menu a.active {
    box-shadow: inset 3px 0 0 var(--red);
    background: rgba(218, 154, 50, .15);
}

.sidebar-logout {
    margin-top: auto;
    padding-top: 15px;
}

.sidebar-menu a.logout-item {
    color: var(--red);
    border-top: 1px solid var(--border-color);
    margin-top: 10px;
}

/* Main Content */
.main-content {
    padding: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.page-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon-box.small {
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid var(--gold);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--red);
    box-shadow: 0 4px 10px rgba(138, 43, 18, 0.1);
}

.page-header h1 {
    margin: 0;
    color: #17345d;
    font-family: 'Oswald', sans-serif;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
}

.account-pill {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: #27ae60;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(39, 174, 96, .3);
    background: rgba(39, 174, 96, .1);
    border-radius: 4px;
}

.account-pill.online::before {
    content: "";
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 6px #2ecc71;
}

/* Info Cards & Grids */
.account-content-inner, .account-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.content-grid {
    display: grid;
    gap: 20px;
    border: 1px solid rgba(23, 52, 93, .24);
    background: rgba(240, 247, 255, .4);
    padding: 24px;
}

.profile-rows {
    display: grid;
    border: 1px solid rgba(23, 52, 93, .2);
}

.profile-rows div {
    display: grid;
    grid-template-columns: 140px 1fr;
    min-height: 42px;
    align-items: center;
    border-bottom: 1px solid rgba(23, 52, 93, .1);
    font-size: 14px;
}

.profile-rows div:last-child {
    border-bottom: 0;
}

.profile-rows span {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: #1e447a;
    background: rgba(235, 245, 255, .5);
    font-weight: 600;
}

.profile-rows strong {
    padding: 0 12px;
    font-weight: 500;
}

.account-warning {
    margin-top: 20px;
    background: rgba(231, 76, 60, .05);
    border: 1px dashed #e74c3c;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    color: #e74c3c;
    font-size: 13px;
    font-weight: 600;
}

/* Forms */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: #a0aec0;
    font-size: 16px;
    pointer-events: none;
    z-index: 5;
}

.form-control {
    width: 100%;
    height: 46px;
    padding: 0 12px 0 42px;
    border: 1px solid rgba(202, 145, 62, .4);
    background: #fff;
    outline: none;
    font-family: inherit;
    font-size: 14px;
}

.form-control:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(155, 43, 18, 0.1);
}

.form-control:focus + .input-icon {
    color: var(--red);
}

/* Validation Styles */
.is-invalid {
    border-color: #c0392b !important;
    background-color: rgba(192, 57, 43, 0.05) !important;
}
.is-valid {
    border-color: #27ae60 !important;
    background-color: rgba(39, 174, 96, 0.05) !important;
}

.validation-msg {
    font-size: 11px;
    margin-top: 5px;
    font-weight: 600;
    display: none;
}

.form-group:has(.is-invalid) .validation-msg {
    display: block;
}

.btn {
    width: 100%;
    height: 46px;
    border: none;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    background: linear-gradient(180deg, #255496, #17345d);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 30, 12, 0.3);
}

.btn:active {
    transform: translateY(0);
}

/* Login/Register Special Layout */
.login-page-body {
    background: #eef5ff !important;
    padding-top: 0 !important;
}

.login-page-body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 16% 18%, rgba(200, 225, 255, .45), transparent 28rem),
        linear-gradient(180deg, rgba(23, 52, 93, 0), rgba(23, 52, 93, .32));
    z-index: 0;
}

.login-page-container {
    position: relative;
    z-index: 1;
    width: min(420px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    justify-content: center;
    padding: 50px 0 40px;
}

.login-card-side {
    width: 100%;
    padding: 32px;
    border: 1px solid var(--gold);
    background:
        linear-gradient(180deg, rgba(245, 252, 255, .96), rgba(235, 245, 255, .94)),
        var(--paper);
    box-shadow: 0 24px 60px rgba(23, 52, 93, .28);
}

.login-card-side h2 {
    margin: 0 0 16px;
    color: var(--wine);
    font-family: 'Oswald', sans-serif;
    font-size: 28px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 16px;
}

.login-card-side h2 i {
    width: 48px;
    height: 48px;
    background: #fff;
    border: 1px solid var(--gold);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--red);
    box-shadow: 0 4px 12px rgba(138, 43, 18, 0.15);
    flex-shrink: 0;
}

.login-card-side .note {
    margin: 0 0 24px;
    color: #254b85;
    font-size: 14px;
    line-height: 1.5;
}

.login-form-field {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.login-form-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.login-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
    font-size: 13px;
    font-weight: 700;
}

.login-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.login-quick-actions a {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wine);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    border: 1px solid rgba(23, 52, 93, 0.4);
    background: rgba(240, 247, 255, 0.6);
    transition: all 0.3s ease;
}

.login-quick-actions a:hover {
    background: #fff;
    border-color: var(--gold);
    color: var(--red);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(202, 145, 62, 0.2);
}

.footer-note {
    width: 100%;
    padding: 24px 0;
    text-align: center;
    font-size: 13px;
    color: #254b85;
    border-top: 1px solid var(--border-color);
    background: rgba(240, 247, 255, .8);
    margin-top: auto;
    position: relative;
    z-index: 10;
}

/* Character Cards */
.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.char-card {
    background: rgba(240, 247, 255, 0.6);
    border: 1px solid var(--border-color);
    padding: 20px;
    box-shadow: 0 4px 12px rgba(23, 52, 93, .08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.char-card:hover {
    transform: translateY(-5px);
    background: rgba(240, 247, 255, 0.9);
    border-color: var(--gold);
}

.char-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.char-avatar {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-color);
}

.char-avatar.male { color: #2980b9; }
.char-avatar.female { color: #c0392b; }

.char-name {
    margin: 0;
    font-size: 18px;
    color: var(--ink);
    font-weight: 800;
}

.char-title {
    font-size: 13px;
    color: #254b85;
    font-style: italic;
}

.char-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.char-stat {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.char-stat .label {
    color: #1e447a;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.char-stat .value {
    color: var(--ink);
    font-weight: 700;
}

.char-stat .value.level {
    color: var(--red);
}

.char-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.btn-char-action {
    flex: 1;
    height: 36px;
    border: 1px solid var(--border-color);
    background: rgba(240, 247, 255, .8);
    color: var(--wine);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-char-action:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

/* Recharge / Donate */
.recharge-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
    background: rgba(240, 247, 255, 0.6);
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: 0 4px 12px rgba(23, 52, 93, .05);
}

.qr-wrapper {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.qr-image {
    width: 100%;
    display: block;
    aspect-ratio: 1;
}

.qr-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(23, 52, 93, 0.85);
    color: #fff;
    padding: 8px;
    text-align: center;
    font-size: 12px;
}

.bank-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bank-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(202, 145, 62, .15);
}

.bank-label {
    color: #1e447a;
    font-size: 14px;
    font-weight: 600;
}

.bank-value {
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
}

.content-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    border-bottom: none;
    background: rgba(255, 255, 255, 0.4);
    padding: 12px;
    border: 1px solid rgba(202, 145, 62, .1);
}

.btn-copy-small {
    background: var(--red);
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.recharge-instructions {
    margin-top: 24px;
    background: rgba(240, 247, 255, .5);
    padding: 20px;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--gold);
}

.recharge-instructions h4 {
    margin: 0 0 10px;
    font-size: 15px;
    color: var(--wine);
    font-weight: 800;
}

.recharge-instructions ul {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #254b85;
    line-height: 1.6;
}

/* Pagination */
.pagination-wrapper {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(240, 247, 255, 0.4);
    border: 1px solid var(--border-color);
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 6px;
}

.pagination li a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--wine);
    font-size: 13px;
    font-weight: 700;
}

.pagination li.active a {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

/* History Table & Status Badges */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.4);
}

.history-table th {
    background: rgba(240, 247, 255, 0.8);
    padding: 12px 18px;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--wine);
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.history-table td {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(202, 145, 62, 0.15);
    font-size: 14px;
    color: var(--ink);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.status-badge.pending { background: rgba(241, 196, 15, 0.15); color: #b7950b; border: 1px solid rgba(241, 196, 15, 0.3); }
.status-badge.success { background: rgba(39, 174, 96, 0.15); color: #1e8449; border: 1px solid rgba(39, 174, 96, 0.3); }
.status-badge.error { background: rgba(192, 57, 43, 0.15); color: #922b21; border: 1px solid rgba(192, 57, 43, 0.3); }

@media (max-width: 900px) {
    .container.has-sidebar {
        grid-template-columns: 1fr;
    }
    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }
}
