/* ============================================================
   ui.css — недостающие компоненты личного кабинета.
   Подключается после styles.css, использует его переменные.
   Закрывает классы, которые используются в разметке, но не были
   описаны: кнопки, алерты, формы, модалки, статусы, карточки.
   ============================================================ */

/* ---------- статусы ---------- */

.l2-status-good {
    color: #7fe08a;
    font-weight: 600;
}

.l2-status-bad {
    color: #ff8a7a;
    font-weight: 600;
}

.l2-link {
    color: var(--l2-gold);
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 215, 0, .35);
}

.l2-link:hover {
    color: #fff3b0;
    border-bottom-color: var(--l2-gold);
}

/* ---------- легаси-таблицы ---------- */

table.maintable {
    width: 100% !important;
    border-collapse: collapse;
    background: rgba(20, 16, 12, .55);
    border: 1px solid rgba(184, 115, 51, .45);
    border-radius: 8px;
    overflow: hidden;
}

.tableheader td,
.tableheader th {
    background: var(--gradient-menu);
    color: var(--l2-gold);
    font-weight: 700;
}

.hitline {
    border-bottom: 1px solid rgba(184, 115, 51, .3);
}

/* ---------- алерты ---------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 8px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert-icon {
    font-size: 18px;
    line-height: 1.2;
    flex: 0 0 auto;
}

.alert-danger {
    background: rgba(231, 76, 60, .12);
    border-color: rgba(231, 76, 60, .55);
    color: #ffb8ad;
}

.alert-success {
    background: rgba(39, 174, 96, .12);
    border-color: rgba(39, 174, 96, .55);
    color: #a9e7bd;
}

.alert-warning {
    background: rgba(243, 156, 18, .12);
    border-color: rgba(243, 156, 18, .55);
    color: #f6d29a;
}

.alert-info {
    background: rgba(52, 152, 219, .12);
    border-color: rgba(52, 152, 219, .55);
    color: #a8d4f5;
}

/* ---------- формы ---------- */

.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    color: #d9b58a;
    font-weight: 600;
    font-size: 13px;
}

.form-control,
.form-input {
    width: 100%;
    padding: 9px 11px;
    border-radius: 8px;
    background: rgba(10, 10, 10, .72);
    border: 1px solid rgba(184, 115, 51, .45);
    color: #f0d8c5;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus,
.form-input:focus {
    border-color: var(--l2-gold);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, .12);
}

select.form-control,
select.form-input {
    background-color: #14100c;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.input-hint {
    display: block;
    margin-top: 5px;
    color: #9c8a72;
    font-size: 12px;
}

/* ---------- кнопки ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, .45);
    background: var(--gradient-btn);
    color: #fff3d6;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-asphalt);
    transition: background .15s, color .15s, transform .12s;
}

.btn:hover {
    background: var(--gradient-btn-hover);
    color: #2a1500;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--asphalt-gradient);
    border-color: rgba(255, 255, 255, .18);
    color: #e0e0e0;
}

.btn-secondary:hover {
    background: var(--asphalt-hover);
    color: #fff;
}

.btn-success {
    background: var(--gradient-success);
    border-color: rgba(46, 204, 113, .6);
    color: #eafff2;
}

.btn-success:hover {
    background: linear-gradient(145deg, rgba(46, 204, 113, .95), rgba(39, 174, 96, .95));
    color: #06210f;
}

.btn-warning {
    background: linear-gradient(145deg, rgba(243, 156, 18, .9), rgba(211, 84, 0, .9));
    border-color: rgba(243, 156, 18, .6);
}

.btn-warning:hover {
    background: linear-gradient(145deg, rgba(255, 184, 60, .95), rgba(230, 100, 10, .95));
    color: #2a1500;
}

.btn-danger {
    background: var(--gradient-danger);
    border-color: rgba(231, 76, 60, .6);
    color: #fff0ee;
}

.btn-danger:hover {
    background: linear-gradient(145deg, rgba(240, 100, 85, .95), rgba(200, 60, 45, .95));
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.btn:disabled,
.btn.disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* кнопки игр и ставок */

.game-btn,
.bet-btn,
.quick-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, .4);
    background: var(--asphalt-gradient);
    color: var(--l2-gold);
    font-weight: 600;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.game-btn:hover,
.bet-btn:hover,
.quick-action-btn:hover {
    background: var(--asphalt-hover);
    color: #fff3b0;
}

.special-bet {
    border-color: rgba(255, 107, 53, .75);
    color: #ffb27a;
}

/* ---------- модальные окна ---------- */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    padding: 20px;
    background: rgba(0, 0, 0, .78);
    align-items: center;
    justify-content: center;
}

.modal.open,
.modal.show {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow: auto;
    background: var(--gradient-dark);
    border: 1px solid rgba(184, 115, 51, .6);
    border-radius: 10px;
    box-shadow: var(--shadow-container);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(184, 115, 51, .35);
}

.modal-header h3 {
    margin: 0;
    color: var(--l2-gold);
    font-size: 16px;
}

.close-modal {
    padding: 0 4px;
    background: none;
    border: 0;
    color: #c9a97b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.close-modal:hover {
    color: #fff;
}

/* ---------- карточки и секции ---------- */

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 12px;
    background: rgba(255, 215, 0, .1);
    border: 1px solid rgba(255, 215, 0, .35);
    color: var(--l2-gold);
}

.stat-card,
.stat-box {
    background: var(--gradient-dark);
    border: 1px solid rgba(184, 115, 51, .4);
    border-radius: 10px;
    padding: 14px 16px;
}

.section {
    margin: 18px 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    color: var(--l2-gold);
    font-size: 15px;
}

.total-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(184, 115, 51, .35);
    color: var(--l2-gold);
    font-weight: 700;
}

/* ---------- поля и строки l2 ---------- */

.l2-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.l2-field-icon {
    width: 22px;
    text-align: center;
    font-size: 16px;
    flex: 0 0 auto;
}

.l2-field-content {
    flex: 1;
    min-width: 0;
}

.l2-section {
    margin: 16px 0;
}

.l2-form-icon {
    margin-right: 6px;
}

.l2-alert-row {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(184, 115, 51, .25);
}

.l2-alert-row:last-child {
    border-bottom: 0;
}

.l2-alert-label {
    min-width: 150px;
    color: #c9a97b;
}

.l2-alert-value {
    flex: 1;
}

.l2-alert-content {
    padding: 4px 0;
}

.l2-stat-icon {
    font-size: 18px;
    line-height: 1;
}

.l2-stat-label {
    color: #c9a97b;
    font-size: 12px;
}

.l2-stat-value {
    color: var(--l2-gold);
    font-weight: 700;
    font-size: 16px;
}

.l2-security-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
}

.l2-security-icon {
    width: 20px;
    text-align: center;
    flex: 0 0 auto;
}

.l2-security-text {
    flex: 1;
    color: #d9c3a5;
}

/* ---------- коэффициенты и пустые состояния ---------- */

.coeff-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    border-bottom: 1px dashed rgba(184, 115, 51, .2);
}

.coeff-item:last-child {
    border-bottom: 0;
}

.coeff-label {
    color: #c9a97b;
}

.coeff-value {
    color: var(--l2-gold);
    font-weight: 700;
}

.balance-label {
    color: #c9a97b;
}

.empty-icon {
    display: block;
    margin-bottom: 8px;
    font-size: 32px;
    opacity: .5;
}

/* ---------- мои персонажи ---------- */

.my-chars {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0;
}

@media (max-width: 1100px) {
    .my-chars { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    .my-chars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .my-chars { grid-template-columns: 1fr; }
}

.my-char {
    display: block;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid rgba(184, 115, 51, .4);
    background: var(--gradient-dark);
    color: #e8dcc8;
    text-decoration: none;
    transition: border-color .15s, transform .12s;
    overflow: hidden;
}

.my-char:hover {
    border-color: var(--l2-gold);
    transform: translateY(-1px);
    text-decoration: none;
}

.my-char-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--l2-gold);
    font-weight: 700;
    font-size: 15px;
    overflow-wrap: anywhere;
}

.my-char-meta {
    margin-top: 6px;
    color: #b9a68c;
    font-size: 12px;
    line-height: 1.6;
}

.my-char .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5a4a3a;
    margin-right: 6px;
    vertical-align: middle;
}

.my-char .dot.on {
    background: #6fdc7f;
    box-shadow: 0 0 6px rgba(111, 220, 127, .8);
}

.char-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin: 14px 0 18px;
}

.char-stat {
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid rgba(184, 115, 51, .35);
    background: rgba(20, 16, 12, .55);
}

.char-stat .cap {
    color: #9c8a72;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.char-stat .val {
    margin-top: 3px;
    color: var(--l2-gold);
    font-weight: 700;
    font-size: 16px;
}

.inv-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inv-item img {
    width: 32px;
    height: 32px;
    display: block;
    image-rendering: pixelated;
}

.inv-amount {
    white-space: nowrap;
}

/* ===== каркас кабинета: сайдбар + контент ===== */

.cp-layout {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.cp-layout > .page-content {
    margin: 0;
    padding: 0;
    min-width: 0;
}

.cp-side {
    position: sticky;
    top: 16px;
    border: 1px solid rgba(184, 146, 90, .28);
    border-radius: 14px;
    background: rgba(20, 16, 13, .82);
    overflow: hidden;
}

.cp-who {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(184, 146, 90, .28);
}

.cp-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    border: 1px solid rgba(232, 192, 106, .35);
    background: radial-gradient(circle at 30% 25%, rgba(232, 192, 106, .25), rgba(232, 192, 106, .05));
    color: #e8c06a;
    font-family: Cinzel, serif;
    font-size: 16px;
    flex: 0 0 auto;
}

.cp-who .cp-name { font-weight: 600; font-size: 14px; }
.cp-who .cp-sub { color: #9d8d78; font-size: 11px; }

.cp-nav { padding: 8px; }

.cp-group {
    padding: 8px 10px 4px;
    font-size: 10px;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: #6f6253;
}

.cp-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 9px;
    color: #e6d9c6;
    text-decoration: none;
    font-size: 13px;
    border: 1px solid transparent;
    transition: .15s;
}

.cp-link:hover {
    background: rgba(255, 255, 255, .04);
    color: #e8c06a;
    text-decoration: none;
}

.cp-link.on {
    color: #e8c06a;
    border-color: rgba(232, 192, 106, .35);
    background: rgba(232, 192, 106, .09);
}

.cp-link .ico {
    width: 18px;
    text-align: center;
    opacity: .85;
    flex: 0 0 auto;
}

.cp-side-foot {
    padding: 8px;
    border-top: 1px solid rgba(184, 146, 90, .28);
}

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

/* ---------- форма смены пароля ---------- */

.pw-card {
    max-width: 560px;
    margin: 0 auto;
    padding: 22px 24px 24px;
    border: 1px solid rgba(184, 146, 90, .28);
    border-radius: 14px;
    background: rgba(20, 16, 13, .82);
}

.pw-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(184, 146, 90, .28);
}

.pw-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid rgba(232, 192, 106, .35);
    background: radial-gradient(circle at 30% 25%, rgba(232, 192, 106, .22), rgba(232, 192, 106, .04));
    font-size: 20px;
    flex: 0 0 auto;
}

.pw-head-text h3 {
    margin: 0;
    font-family: Cinzel, serif;
    font-size: 18px;
    letter-spacing: .4px;
    color: #e8c06a;
}

.pw-head-text p {
    margin: 3px 0 0;
    font-size: 12px;
    color: #9d8d78;
}

.pw-field { margin-bottom: 14px; }

.pw-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #d9b58a;
}

.pw-input {
    width: 100%;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid rgba(184, 146, 90, .45);
    background: rgba(8, 7, 6, .65);
    color: #f0d8c5;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: .15s;
}

.pw-input:focus {
    border-color: #e8c06a;
    box-shadow: 0 0 0 2px rgba(232, 192, 106, .12);
}

.pw-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 14px;
    color: #7d6d5a;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.pw-divider:before,
.pw-divider:after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(184, 146, 90, .28);
}

.pw-captcha {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pw-captcha img {
    display: block;
    border-radius: 8px;
}

.pw-captcha .pw-input {
    flex: 1;
    min-width: 160px;
}

.pw-submit {
    width: 100%;
    margin-top: 6px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(232, 192, 106, .45);
    background: linear-gradient(160deg, rgba(232, 192, 106, .24), rgba(120, 74, 24, .2));
    color: #e8c06a;
    font: 700 14px "Segoe UI", sans-serif;
    cursor: pointer;
    transition: .15s;
}

.pw-submit:hover {
    background: linear-gradient(160deg, rgba(232, 192, 106, .34), rgba(120, 74, 24, .28));
}

.pw-note {
    max-width: 560px;
    margin: 12px auto 0;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px dashed rgba(184, 146, 90, .28);
    color: #9d8d78;
    font-size: 12px;
}

/* ---------- аккаунт в форме ---------- */

.account-badge {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(184, 115, 51, .45);
    background: rgba(10, 10, 10, .45);
    color: var(--l2-gold, #e8c06a);
    font-weight: 600;
    font-size: 15px;
}

/* ---------- блок «успешно» (смена пароля и т.п.) ---------- */

/* styles.css делает .success-message флексом — из-за этого детали и
   предупреждение встают в один ряд и сжимаются до одной буквы в строке */
.form-container .success-message,
.success-container .success-message {
    display: block;
}

.form-container .success-message > *,
.success-container .success-message > * {
    width: 100%;
    box-sizing: border-box;
}

.form-container .success-details.change-password-details .detail-item {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.form-container .success-details.change-password-details .detail-item:last-child {
    border-bottom: 0;
}

.form-container .success-details.change-password-details .detail-icon {
    flex: 0 0 auto;
    min-width: 24px;
    text-align: center;
}

.form-container .success-details.change-password-details .detail-label {
    flex: 0 0 auto;
    min-width: 140px;
    color: #FFD700;
    font-weight: 600;
}

.form-container .success-details.change-password-details .detail-value {
    flex: 1 1 auto;
    min-width: 0;
    word-break: normal;
    overflow-wrap: anywhere;
}

/* Предупреждение внутри блока: flex съедает пробелы между текстом и <strong> */
.success-container .warning-alert,
.form-container .success-message .warning-alert {
    display: block;
}

@media (max-width: 640px) {
    .form-actions .btn {
        width: 100%;
    }

    .l2-alert-row {
        flex-direction: column;
        gap: 2px;
    }

    .l2-alert-label {
        min-width: 0;
    }

    .form-container .success-details.change-password-details .detail-item {
        flex-wrap: wrap;
    }
}
