/**
 * Styles for frontend components of the Invest Cabinet plugin.
 * @version 3.8 (Unified Deposit UI Styles)
 */

:root {
    --ic-bg-white: #ffffff;
    --ic-border-color: #dee2e6;
    --ic-primary-color: #007bff;
    --ic-primary-hover: #0056b3;
    --ic-text-dark: #212529;
    --ic-text-light: #6c757d;
    --ic-text-white: #ffffff;
    --ic-success: #28a745;
    --ic-danger: #dc3545;
    --ic-warning: #ffc107;
    --ic-frozen: #fd7e14;
    --ic-investment: #20c997;
    --ic-profit: var(--ic-success);
    --ic-balance: var(--ic-primary-color);
    --ic-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --ic-shadow: 0 4px 12px rgba(0,0,0,0.08);
    --ic-radius: 8px;
    --ic-bg-light: #f8f9fa;
}

/* --- AUTH FORM STYLES --- */
.xtb-auth-wrapper {
    padding: 40px 15px;
    box-sizing: border-box;
    font-family: var(--ic-font-family);
    background-color: var(--ic-bg-light);
}
.xtb-auth-container {
    max-width: 420px;
    margin: 0 auto;
    background: var(--ic-bg-white);
    padding: 40px;
    border-radius: var(--ic-radius);
    box-shadow: var(--ic-shadow);
    border: 1px solid var(--ic-border-color);
}
.auth-tab-content {
    display: none; /* Hide all tabs by default */
}
.auth-tab-content.active {
    display: block; /* Show only the active tab */
}
#auth-title {
    text-align: center; font-size: 28px; font-weight: 700; color: var(--ic-text-dark); margin-bottom: 24px;
}
.auth-tabs {
    display: grid; grid-template-columns: 1fr 1fr; background-color: var(--ic-bg-light); border-radius: var(--ic-radius); padding: 4px; margin-bottom: 24px;
}
.auth-tab-link {
    padding: 10px; text-align: center; background: transparent; border: 0; color: var(--ic-text-light); font-weight: 600; cursor: pointer; border-radius: 6px; transition: all 0.25s ease-in-out;
}
.auth-tab-link.active {
    background: var(--ic-bg-white); color: var(--ic-primary-color); box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.form-row-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.form-row input[type="email"], .form-row input[type="password"], .form-row input[type="text"], .form-row input[type="tel"] {
    width: 100%; padding: 12px 15px; border: 1px solid var(--ic-border-color); border-radius: 6px; box-sizing: border-box; font-size: 16px; background-color: var(--ic-bg-white); color: var(--ic-text-dark); transition: border-color 0.2s, box-shadow 0.2s;
}
.form-row input:focus {
    border-color: var(--ic-primary-color); outline: 0; box-shadow: 0 0 0 3px rgba(0,123,255, 0.15);
}
.auth-button {
    width: 100%; padding: 14px; font-size: 16px; background-color: var(--ic-primary-color); color: var(--ic-text-white); border: none; border-radius: 6px; cursor: pointer; font-weight: 700; transition: background-color 0.2s, transform 0.2s;
}
.auth-button:hover {
    background-color: var(--ic-primary-hover); transform: translateY(-2px);
}
.auth-lost-password a, .auth-back-to-login a {
    color: var(--ic-text-light); font-size: 14px;
}
.auth-lost-password a:hover, .auth-back-to-login a:hover {
    color: var(--ic-primary-color);
}
.lost-password-info {
    margin-bottom: 1rem;
}
p.form-row {
    margin-bottom: 1rem;
}

/* --- NEW PERSONAL CABINET DESIGN --- */
.invest-cabinet-container {
    font-family: var(--ic-font-family); color: var(--ic-text-dark); max-width: 1200px; margin: 40px auto; padding: 0 15px;
}
.cabinet-header {
    display: flex; justify-content: space-between; align-items: center; padding: 24px; background-color: var(--ic-bg-white); border-radius: var(--ic-radius); box-shadow: var(--ic-shadow); margin-bottom: 24px;
}
.user-profile-summary {
    display: flex; align-items: center; gap: 16px;
}
.user-profile-summary .avatar-wrapper {
    width: 60px; height: 60px; border-radius: 50%; overflow: hidden;
}
.user-profile-summary .avatar-wrapper img {
    width: 100%; height: 100%; object-fit: cover;
}
.user-profile-summary .user-details h2 {
    margin: 0; font-size: 22px; font-weight: 600; color: var(--ic-text-dark);
}
.user-profile-summary .user-details p {
    margin: 0; font-size: 14px; color: var(--ic-text-light);
}
.header-actions .logout-link {
    display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ic-text-light); font-weight: 500; padding: 8px 12px; border-radius: 6px; transition: all 0.2s ease;
}
.header-actions .logout-link:hover {
    background-color: var(--ic-bg-light); color: var(--ic-danger);
}
/* Cabinet Navigation */
.cabinet-navigation {
    display: flex;
    gap: 8px;
    background-color: var(--ic-bg-light);
    border-radius: var(--ic-radius);
    padding: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap; /* ** FIX: Allow items to wrap ** */
}
.cabinet-navigation .nav-item {
    flex: 1 0 auto;
    text-align: center;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 6px;
    color: var(--ic-text-light);
    font-weight: 600;
    transition: all 0.25s ease-in-out;
}
.cabinet-navigation .nav-item:hover {
    background-color: #e9ecef; color: var(--ic-text-dark);
}
.cabinet-navigation .nav-item.active {
    background-color: var(--ic-bg-white); color: var(--ic-primary-color); box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
/* Tab Content */
.tab-content {
    display: none; background-color: var(--ic-bg-white); border-radius: var(--ic-radius); box-shadow: var(--ic-shadow); padding: 32px;
}
.tab-content.active {
    display: block;
}
/* Balance Grid */
.balance-info-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-bottom: 32px;
}
.balance-card {
    padding: 24px; border-radius: var(--ic-radius); border: 1px solid var(--ic-border-color); transition: all 0.2s ease;
}
.balance-card:hover {
    transform: translateY(-4px); box-shadow: var(--ic-shadow);
}
.balance-card .label {
    font-size: 14px; font-weight: 500; color: var(--ic-text-light); margin-bottom: 8px;
}
.balance-card .value {
    font-size: 28px; font-weight: 700; line-height: 1.2;
}
.balance-card .currency {
    font-size: 16px; font-weight: 500; color: var(--ic-text-light); margin-left: 4px;
}
.balance-card.frozen .value { color: var(--ic-frozen); }
.balance-card.investment .value { color: var(--ic-investment); }
.balance-card.profit .value { color: var(--ic-success); }
.balance-card.total .value { color: var(--ic-balance); }

/* Forms inside tabs */
.form-content-wrapper { max-width: 600px; margin: 0 auto; }
.form-content-wrapper h3, .form-content-wrapper h4 { text-align: center; font-size: 24px; margin-bottom: 24px; }
.form-content-wrapper label { display: block; font-weight: 600; margin-bottom: 8px; }
.form-content-wrapper input[type="text"], .form-content-wrapper input[type="tel"], .form-content-wrapper input[type="password"], .form-content-wrapper input[type="number"], .form-content-wrapper select {
    width: 100%; padding: 12px; margin-bottom: 16px; border: 1px solid var(--ic-border-color); border-radius: 6px; font-size: 1em; box-sizing: border-box;
}
.form-content-wrapper input:focus, .form-content-wrapper select:focus {
    border-color: var(--ic-primary-color); outline: none; box-shadow: 0 0 0 3px rgba(0,123,255, 0.15);
}
.form-content-wrapper .button.btn-primary {
    width: 100%; padding: 14px; font-size: 16px; background-color: var(--ic-primary-color); color: var(--ic-text-white); border: none; border-radius: 6px; cursor: pointer; font-weight: 700;
}
.form-content-wrapper .button.btn-primary:hover { background-color: var(--ic-primary-hover); }
.form-content-wrapper .button.btn-secondary {
    width: 100%; padding: 14px; font-size: 16px; background-color: var(--ic-text-light); color: var(--ic-text-white); border: none; border-radius: 6px; cursor: pointer; font-weight: 700;
}
.form-content-wrapper .button.btn-secondary:hover { background-color: #5a6268; }
.radio-group { margin-bottom: 16px; }
.radio-group label.radio-label { display: inline-block; margin-right: 16px; font-weight: 500; }
.withdraw-step, .topup-step { display: none; }
.withdraw-step.active, .topup-step.active { display: block; }

/* Deposit Flow Styles */
.card-details-box {
    background-color: var(--ic-bg-light); padding: 24px;
    border-radius: var(--ic-radius); border: 1px solid var(--ic-border-color);
    margin-bottom: 16px;
}
.card-details-box p { margin-top: 0; }
.card-details-box .detail-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--ic-border-color);
}
.card-details-box .detail-item:last-child { border-bottom: none; }
.card-details-box .detail-item span { color: var(--ic-text-light); }
.card-details-box .detail-item.total-amount strong {
    font-size: 1.2em; color: var(--ic-danger);
}
.topup-instruction-box {
    margin-top: 1rem;
}

/* History Table */
.history-table-container {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.history-table-container h3 { font-size: 24px; margin-bottom: 16px; }
.history-table {
    width: 100%; border-collapse: collapse; min-width: 500px;
}
.history-table th, .history-table td { 
    padding: 16px; text-align: left; 
    border-bottom: 1px solid var(--ic-border-color); 
    white-space: nowrap;
}
.history-table th { background-color: var(--ic-bg-light); font-size: 14px; font-weight: 600; }
.history-table tbody tr:last-child td { border-bottom: 0; }

/* Profile Tab */
.profile-section { margin-bottom: 32px; padding-bottom: 32px; border-bottom: 1px solid var(--ic-border-color); }
.profile-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.profile-section h4 { font-size: 20px; margin-bottom: 16px; }
.avatar-section { margin-bottom: 16px; }
.avatar-section .avatar-wrapper { position: relative; width: 80px; height: 80px; }
.avatar-section .avatar-wrapper a { display: block; border-radius: 50%; overflow: hidden; width: 80px; height: 80px; }
.avatar-section .avatar-loader {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; border: 3px solid rgba(0, 0, 0, 0.1); border-top-color: var(--ic-primary-color); border-radius: 50%; animation: spin 1s linear infinite;
}

/* NEW Calculator Design */
.calculator-new-container { background: var(--ic-bg-white); border: 1px solid var(--ic-border-color); border-radius: var(--ic-radius); margin-top: 32px; overflow: hidden; }
.calculator-new-header { background-color: var(--ic-bg-light); padding: 16px 24px; border-bottom: 1px solid var(--ic-border-color); }
.calculator-new-header h3 { margin: 0; font-size: 18px; color: var(--ic-text-dark); }
.calculator-new-body { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 24px; }
.calculator-new-slider-group { display: flex; flex-direction: column; }
.calculator-new-slider-group label { font-size: 14px; color: var(--ic-text-light); margin-bottom: 8px; }
.calculator-new-slider-group .value { font-size: 24px; font-weight: 600; color: var(--ic-text-dark); margin-bottom: 16px; }
.calculator-new-result { background-color: var(--ic-primary-color); color: var(--ic-text-white); padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; font-size: 18px; }
.calculator-new-result strong { font-size: 22px; font-weight: 700; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--ic-border-color); border-radius: 3px; outline: none; transition: background 0.2s ease; }
input[type="range"]:hover { background: #ced4da; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; background: var(--ic-primary-color); border-radius: 50%; cursor: pointer; border: 3px solid var(--ic-bg-white); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

/* --- TOP EARNERS --- */
.top-earners-container { background: var(--ic-bg-white); padding: 32px; border-radius: var(--ic-radius); border: 1px solid var(--ic-border-color); text-align: center; margin-top: 32px; }
.top-earners-container h2 { color: var(--ic-text-dark); font-size: 22px; margin-bottom: 8px; }
.top-earners-container p.subtitle { color: var(--ic-text-light); margin-bottom: 24px; }
.top-earners-container .top-earner-item { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--ic-border-color); color: var(--ic-text-dark); text-align: left; }
.top-earners-container .top-earner-item:last-child { border-bottom: none; }
.top-earners-container .profit-amount { margin-left: auto; font-weight: 600; color: var(--ic-success); }
.top-earners-container .avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; margin-right: 12px; }
.top-earners-container .avatar img { width: 100%; height: 100%; object-fit: cover; }
.top-earners-container .user-details .name { font-weight: 600; }
.top-earners-container .user-details .email { font-size: 12px; color: var(--ic-text-light); }

/* General & Helper Classes */
.message-box { margin-top: 15px; padding: 12px; border-radius: 6px; text-align: center; }
.message-box.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.message-box.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.status-badge { padding: 4px 10px; border-radius: 12px; font-size: 0.85em; font-weight: bold; color: #fff; }
.status-badge.status-completed { background-color: var(--ic-success); }
.status-badge.status-pending { background-color: var(--ic-warning); color: var(--ic-text-dark); }
.status-badge.status-cancelled { background-color: var(--ic-danger); }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    .cabinet-header { flex-direction: column; gap: 16px; text-align: center; }
    .header-actions { margin-top: 16px; }
    .calculator-new-body { grid-template-columns: 1fr; }
    .form-row-grid { grid-template-columns: 1fr; }
}
@media (max-width: 576px) {
    .balance-info-grid { grid-template-columns: 1fr; }
    .tab-content { padding: 24px; }
    .xtb-auth-container { padding: 24px; }
}

