/* ============================================
   Dashboard - Premium Dark Theme
   ============================================ */

/* ============================================
   Stats Grid
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-10);
}

.stat-card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out backwards;
    box-shadow: var(--shadow-lg);
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.15s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.25s;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-border);
    transform: scaleX(0);
    transition: transform var(--transition);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border-color: var(--primary-500);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto var(--space-4);
    background: var(--gradient-main);
    border-radius: var(--radius-lg);
    animation: float 4s ease-in-out infinite;
    box-shadow: var(--shadow-md), 0 0 30px rgba(139, 92, 246, 0.3);
}

.stat-card .stat-icon svg {
    width: 32px;
    height: 32px;
    stroke: white;
}

.stat-card h4 {
    color: var(--text-muted);
    font-size: 0.6875rem;
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.15em;
}

.stat-card .stat-value {
    font-size: 2.75rem;
    font-weight: 800;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

/* ============================================
   Chat Container
   ============================================ */
.chat-container {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.8s ease-out;
}

/* Chat Sidebar */
.chat-sidebar {
    width: 320px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    background: var(--bg-glass);
    flex-shrink: 0;
}

.chat-sidebar::-webkit-scrollbar {
    width: 6px;
}

.chat-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.chat-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

.chat-user-item {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.chat-user-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--gradient-main);
    transform: scaleY(0);
    transition: transform var(--transition);
}

.chat-user-item:hover,
.chat-user-item.active {
    background: var(--bg-glass-hover);
    padding-left: var(--space-6);
}

.chat-user-item.active::before {
    transform: scaleY(1);
}

.chat-user-item h4 {
    margin-bottom: var(--space-1);
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9375rem;
}

.chat-user-item p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

/* Chat Main */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    min-width: 0;
}

.chat-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
}

.chat-header h3 {
    margin: 0;
    color: var(--text-color);
    font-weight: 700;
    font-size: 1.125rem;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: var(--space-6);
    overflow-y: auto;
    background: var(--gradient-hero);
    background-attachment: fixed;
}

/* Message Bubbles */
.message-bubble {
    margin-bottom: var(--space-5);
    display: flex;
    flex-direction: column;
    max-width: 70%;
    animation: fadeInUp 0.4s ease-out;
}

.message-bubble.bot {
    align-items: flex-start;
    margin-right: auto;
}

.message-bubble.user {
    align-items: flex-end;
    margin-left: auto;
}

.message-sender {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
    padding: 0 var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.message-content {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    word-wrap: break-word;
    box-shadow: var(--shadow);
    position: relative;
    backdrop-filter: blur(10px);
}

.message-bubble.bot .message-content {
    background: var(--bg-glass);
    border-bottom-left-radius: var(--radius-sm);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.message-bubble.user .message-content {
    background: var(--gradient-main);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(139, 92, 246, 0.2);
}

.message-text {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.message-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: var(--space-2);
    padding: 0 var(--space-2);
}

/* Chat Input */
.chat-input {
    padding: var(--space-5) var(--space-6);
    border-top: 1px solid var(--border-color);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.chat-input input {
    flex: 1;
    padding: var(--space-4) var(--space-5);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    background: var(--bg-secondary);
    color: var(--text-color);
    transition: all var(--transition);
    font-family: var(--font-family);
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), var(--shadow-glow);
}

.chat-input button {
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-full);
    white-space: nowrap;
    font-weight: 600;
}

/* ============================================
   Modal Styles
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
    padding: var(--space-4);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--gradient-card);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--border-color);
    animation: scaleIn 0.4s ease-out;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-color);
    font-weight: 700;
    font-size: 1.375rem;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    line-height: 1;
}

.close-btn:hover {
    color: var(--danger-color);
    background: var(--danger-light);
    border-color: var(--danger-color);
    transform: rotate(90deg);
}

/* ============================================
   Account Page
   ============================================ */
.account-hero {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.account-balance-card {
    position: relative;
    padding: var(--space-10);
    border-radius: var(--radius-2xl);
    background: var(--gradient-main);
    background-size: 400% 400%;
    animation: gradientFlow 10s ease infinite;
    box-shadow: var(--shadow-xl), var(--shadow-glow-lg);
    overflow: hidden;
    color: white;
}

.account-balance-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
}

.account-balance-amount {
    font-size: 4rem;
    font-weight: 800;
    margin: var(--space-6) 0 var(--space-2);
    position: relative;
    z-index: 1;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.account-balance-amount span {
    font-size: 1.25rem;
    font-weight: 600;
    opacity: 0.8;
}

.account-topup-btn {
    background: white;
    color: var(--primary-700);
    border: none;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: all var(--transition);
}

.account-topup-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .chat-container {
        height: calc(100vh - 160px);
    }

    .chat-sidebar {
        width: 280px;
    }

    .account-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

    .stat-card {
        padding: var(--space-5);
    }

    .stat-card .stat-icon {
        width: 56px;
        height: 56px;
    }

    .stat-card .stat-value {
        font-size: 2rem;
    }

    .chat-container {
        flex-direction: column;
        height: calc(100vh - 120px);
    }

    .chat-sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .modal-content {
        padding: var(--space-6);
        border-radius: var(--radius-xl);
    }

    .account-balance-card {
        padding: var(--space-6);
    }

    .account-balance-amount {
        font-size: 2.75rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        display: flex;
        align-items: center;
        gap: var(--space-4);
        text-align: left;
    }

    .stat-card .stat-icon {
        margin: 0;
        width: 52px;
        height: 52px;
    }

    .stat-card .stat-info {
        flex: 1;
    }

    .chat-sidebar {
        height: 150px;
    }

    .chat-messages {
        padding: var(--space-4);
    }

    .message-bubble {
        max-width: 85%;
    }

    .chat-input {
        padding: var(--space-4);
        flex-wrap: wrap;
    }

    .chat-input input {
        flex: 1;
        min-width: 0;
    }

    .chat-input button {}
}

/* ============================================
   Account Page Styles
   ============================================ */
.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.account-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

.info-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.password-form {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.password-form.collapsed {
    max-height: 0;
}

.password-form:not(.collapsed) {
    max-height: 500px;
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.bot-list {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.bot-item {
    display: block;
    padding: var(--space-5);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.bot-item input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.bot-item:hover {
    background: var(--bg-glass-hover);
    border-color: var(--primary-400);
    transform: translateX(5px);
}

.bot-item input[type="radio"]:checked+.bot-item-body {
    border-left: 3px solid var(--primary-500);
    padding-left: var(--space-4);
}

.bot-item input[type="radio"]:checked~* {
    border-color: var(--primary-500);
}

.bot-item input[type="radio"]:checked {
    &~* {
        background: var(--bg-glass-hover);
    }
}

.bot-item-body {
    transition: all var(--transition);
}

.bot-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.bot-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-color);
}

.bot-username {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.bot-meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.account-hero-stats {
    display: grid;
    gap: var(--space-4);
}

.hero-stat {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    padding: var(--space-5);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.hero-stat svg {
    margin-bottom: var(--space-2);
    opacity: 0.8;
}

.hero-stat:hover {
    transform: translateY(-5px);
    border-color: var(--primary-500);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.hero-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.hero-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
}

.hero-stat-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Account Balance Card fixes */
.account-balance-card {
    position: relative;
    padding: var(--space-10);
    border-radius: var(--radius-2xl);
    background: var(--gradient-main);
    background-size: 400% 400%;
    animation: gradientFlow 10s ease infinite;
    box-shadow: var(--shadow-xl), var(--shadow-glow-lg);
    overflow: hidden;
    color: white;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.account-balance-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
}

.account-badge {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.9;
    margin-bottom: var(--space-3);
}

.account-balance-amount {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    margin: var(--space-4) 0;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

.account-balance-amount span {
    font-size: 1.25rem;
    font-weight: 600;
    opacity: 0.8;
}

.account-balance-desc {
    font-size: 0.9375rem;
    opacity: 0.9;
    margin-bottom: var(--space-6);
    line-height: 1.6;
}

.account-hero-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.account-topup-btn {
    background: white !important;
    color: var(--primary-700) !important;
    border: none;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition);
}

.account-topup-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.account-topup-btn svg {
    stroke: var(--primary-700) !important;
}

@media (max-width: 768px) {
    .account-grid {
        grid-template-columns: 1fr;
    }

    .account-info-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .account-hero {
        grid-template-columns: 1fr !important;
    }

    .account-balance-card {
        min-height: auto;
        padding: var(--space-8);
    }

    .account-balance-amount {
        font-size: 2.5rem;
    }

    .bot-item {
        padding: var(--space-4);
    }

    .bot-name {
        font-size: 1rem;
    }
}