/* ===== CSS VARIABLES ===== */
:root {
    --bg-primary: #0b0e14;
    --bg-secondary: #131820;
    --bg-card: #0e141c;
    --bg-input: #1a2230;
    --border-color: #212b38;
    --text-primary: #e8edf5;
    --text-secondary: #8899aa;
    --text-muted: #556677;
    --blue-primary: #2962ff;
    --blue-hover: #1a4fd0;
    --green-profit: #6bff8a;
    --red-loss: #ff6b6b;
    --gold: #ffd700;
    --success: #00b894;
    --danger: #ff4757;
}

/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.8rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.5rem;
    font-weight: 800;
}

.logo i {
    color: var(--blue-primary);
    font-size: 1.8rem;
}

.logo span {
    color: var(--blue-primary);
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-links a {
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: 0.2s;
}

.nav-links a:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.nav-links a.active {
    background: var(--blue-primary);
    color: white;
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#userDisplay {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: var(--blue-primary);
    color: white;
    border: none;
    padding: 0.7rem 1.8rem;
    border-radius: 40px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--blue-hover);
    transform: scale(1.02);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.7rem 1.8rem;
    border-radius: 40px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.7rem 1.8rem;
    border-radius: 40px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-success:hover {
    background: #00a381;
    transform: scale(1.02);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.7rem 1.8rem;
    border-radius: 40px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background: #e53e4a;
    transform: scale(1.02);
}

.btn-small {
    padding: 0.3rem 0.8rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: 0.2s;
    font-size: 0.85rem;
}

.btn-small:hover {
    background: var(--border-color);
}

/* ===== MAIN CONTENT ===== */
main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== HERO ===== */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    padding: 2rem 0 4rem;
    align-items: center;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.2rem;
}

.hero-content h1 span {
    color: var(--blue-primary);
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
    text-align: center;
}

.stat-card i {
    font-size: 2rem;
    color: var(--blue-primary);
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== FEATURES ===== */
.features {
    padding: 3rem 0;
}

.features h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
}

.features h2 span {
    color: var(--blue-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
    text-align: center;
    transition: 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--blue-primary);
}

.feature-card i {
    font-size: 2.5rem;
    color: var(--blue-primary);
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===== DASHBOARD ===== */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.dashboard-stats .stat-card {
    text-align: left;
    padding: 1.2rem 1.5rem;
}

.dashboard-stats .stat-card span {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.dashboard-stats .stat-card h3 {
    font-size: 1.8rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
}

.chart-section h3 {
    margin-bottom: 1rem;
}

.chart-container {
    height: 350px;
    background: var(--bg-primary);
    border-radius: 1rem;
    overflow: hidden;
}

.chart-container canvas {
    width: 100%;
    height: 100%;
}

.recent-trades {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
}

.recent-trades h3 {
    margin-bottom: 1rem;
}

.trade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
}

.trade-item:last-child {
    border-bottom: none;
}

.trade-pair {
    font-weight: 600;
    font-size: 0.95rem;
}

.trade-direction {
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
}

.trade-direction.buy {
    background: rgba(107, 255, 138, 0.15);
    color: var(--green-profit);
}

.trade-direction.sell {
    background: rgba(255, 107, 107, 0.15);
    color: var(--red-loss);
}

.trade-amount {
    font-weight: 600;
}

.trade-profit {
    font-weight: 700;
}

.trade-profit.profit {
    color: var(--green-profit);
}

.trade-profit.loss {
    color: var(--red-loss);
}

/* ===== CHAT WIDGET ===== */
.chat-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
    height: 400px;
    display: flex;
    flex-direction: column;
}

.chat-widget h3 {
    margin-bottom: 0.8rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 0.8rem;
    padding-right: 0.3rem;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--blue-primary);
    border-radius: 10px;
}

.chat-msg {
    background: var(--bg-input);
    padding: 0.5rem 0.8rem;
    border-radius: 12px;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-msg .user {
    font-weight: 700;
    color: var(--blue-primary);
}

.chat-msg .time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.chat-input-group {
    display: flex;
    gap: 0.6rem;
}

.chat-input-group input {
    flex: 1;
    padding: 0.7rem 1rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.chat-input-group input:focus {
    border-color: var(--blue-primary);
}

.chat-input-group button {
    padding: 0.7rem 1.2rem;
    border-radius: 30px;
    border: none;
    background: var(--blue-primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: 0.2s;
}

.chat-input-group button:hover {
    background: var(--blue-hover);
}

/* ===== TRADING PAGE ===== */
.trading-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
}

.trading-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
}

.trading-panel h2 {
    margin-bottom: 1.2rem;
}

.mode-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: 40px;
    padding: 0.2rem;
    margin-bottom: 1.2rem;
}

.mode-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.6rem 0.5rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.mode-btn.active {
    background: var(--blue-primary);
    color: white;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.form-group select:focus,
.form-group input:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.15);
}

.deposit-area {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.deposit-area h4 {
    margin-bottom: 0.8rem;
}

.deposit-group {
    display: flex;
    gap: 0.6rem;
}

.deposit-group input {
    flex: 2;
    padding: 0.7rem 1rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.deposit-group input:focus {
    border-color: var(--blue-primary);
}

.deposit-group button {
    flex: 1;
    padding: 0.7rem;
    border-radius: 30px;
}

.quick-deposit {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
    flex-wrap: wrap;
}

.quick-deposit button {
    padding: 0.3rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
    font-family: 'Inter', sans-serif;
}

.quick-deposit button:hover {
    border-color: var(--blue-primary);
    color: var(--text-primary);
}

.trading-info {
    display: flex;
    justify-content: space-between;
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.trading-info span {
    color: var(--text-primary);
    font-weight: 600;
}

.status-active {
    color: var(--green-profit);
}

.status-manual {
    color: var(--gold);
}

/* ===== ORDER BOOK ===== */
.order-book-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
}

.order-book-panel h3 {
    margin-bottom: 1rem;
}

.order-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-color);
}

.order-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 0.2rem 0;
    color: var(--text-secondary);
}

.order-row.bid .price {
    color: var(--green-profit);
}

.order-row.ask .price {
    color: var(--red-loss);
}

.order-row.current-price {
    background: var(--bg-input);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    margin: 0.2rem 0;
}

/* ===== BOT PAGE ===== */
.bot-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.bot-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
}

.bot-card h3 {
    margin-bottom: 1rem;
}

.bot-status {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.active {
    background: var(--green-profit);
    box-shadow: 0 0 10px rgba(107, 255, 138, 0.3);
}

.status-indicator.inactive {
    background: var(--text-muted);
}

.settings-group label {
    display: block;
    margin-bottom: 0.8rem;
}

.settings-group label span {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.settings-group input,
.settings-group select {
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.settings-group select[multiple] {
    height: 80px;
    border-radius: 16px;
}

.settings-group button {
    width: 100%;
    margin-top: 0.8rem;
}

.bot-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.stat-item {
    background: var(--bg-input);
    border-radius: 1rem;
    padding: 0.8rem;
}

.stat-item span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-item strong {
    font-size: 1.3rem;
}

.bot-history {
    margin-top: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
}

.history-item {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item .pair {
    font-weight: 600;
    min-width: 80px;
}

.history-item .direction {
    font-weight: 600;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.history-item .direction.buy {
    background: rgba(107, 255, 138, 0.15);
    color: var(--green-profit);
}

.history-item .direction.sell {
    background: rgba(255, 107, 107, 0.15);
    color: var(--red-loss);
}

.history-item .amount {
    font-weight: 600;
}

.history-item .profit {
    font-weight: 700;
}

.history-item .profit.profit {
    color: var(--green-profit);
}

.history-item .profit.loss {
    color: var(--red-loss);
}

.history-item .time {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
}

/* ===== ADMIN PAGE ===== */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.tab-btn {
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.2s;
    font-family: 'Inter', sans-serif;
}

.tab-btn:hover {
    background: var(--bg-input);
}

.tab-btn.active {
    background: var(--blue-primary);
    color: white;
    border-color: var(--blue-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.admin-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    padding: 0.8rem 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.admin-table td {
    padding: 0.6rem 0.5rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table .profit {
    color: var(--green-profit);
}

.admin-table .loss {
    color: var(--red-loss);
}

.admin-table .buy {
    color: var(--green-profit);
}

.admin-table .sell {
    color: var(--red-loss);
}

.admin-table .loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.settings-form {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 500px;
}

.settings-form h3 {
    margin-bottom: 1.5rem;
}

/* ===== PROFILE PAGE ===== */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
}

.profile-header {
    text-align: center;
    padding: 2rem 0;
}

.avatar {
    width: 80px;
    height: 80px;
    background: var(--blue-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1rem;
}

.profile-header h2 {
    font-size: 1.8rem;
}

.profile-header p {
    color: var(--text-secondary);
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
    text-align: center;
}

.profile-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.profile-card h2 {
    font-size: 1.8rem;
}

.profile-form {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
}

.profile-form h3 {
    margin-bottom: 1.5rem;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    color: var(--text-secondary);
    text-align: center;
    padding: 1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .hero-content p {
        margin: 0 auto 2rem;
    }
    .hero-buttons {
        justify-content: center;
    }
    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .trading-container {
        grid-template-columns: 1fr;
    }
    .bot-controls {
        grid-template-columns: 1fr 1fr;
    }
    .profile-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: stretch;
    }
    .nav-links {
        justify-content: center;
    }
    .nav-auth {
        justify-content: center;
    }
    .hero-content h1 {
        font-size: 2.2rem;
    }
    .hero-stats {
        grid-template-columns: 1fr;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    .bot-controls {
        grid-template-columns: 1fr;
    }
    .profile-grid {
        grid-template-columns: 1fr 1fr;
    }
    .dashboard-stats {
        grid-template-columns: 1fr 1fr;
    }
    main {
        padding: 1rem;
    }
    .navbar {
        padding: 0.8rem 1rem;
    }
    .quick-deposit {
        justify-content: center;
    }
}

@media (max-width: 500px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    .trading-info {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .history-item {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .history-item .time {
        margin-left: 0;
    }
    .deposit-group {
        flex-direction: column;
    }
}