/* ============================================
   SUPPORT SYSTEM — Unique Dark Neon Design
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+Bengali:wght@400;500;600;700&display=swap');

:root {
    --bg: #0a0a0f;
    --bg2: #12121a;
    --bg3: #1a1a28;
    --bg-glass: rgba(18, 18, 26, 0.75);
    --primary: #7c5cfc;
    --primary-hover: #6a4aef;
    --primary-glow: rgba(124, 92, 252, 0.35);
    --accent: #00e5c0;
    --accent-dim: rgba(0, 229, 192, 0.15);
    --success: #22c55e;
    --danger: #f43f5e;
    --warning: #fbbf24;
    --text: #f1f0f5;
    --text-muted: #8b8798;
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);
    --user-bubble: linear-gradient(135deg, #7c5cfc 0%, #5b3fd4 100%);
    --agent-bubble: #1a1a28;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 40px var(--primary-glow);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans Bengali', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); text-decoration: none; }

/* ========== ANIMATED BG MESH ========== */
.form-wrapper,
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}

.form-wrapper::before,
.login-wrapper::before {
    content: '';
    position: absolute;
    inset: -50%;
    background:
        radial-gradient(ellipse 50% 40% at 20% 30%, rgba(124, 92, 252, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 40% 50% at 80% 70%, rgba(0, 229, 192, 0.1) 0%, transparent 55%),
        radial-gradient(ellipse 30% 30% at 50% 50%, rgba(124, 92, 252, 0.08) 0%, transparent 50%);
    animation: meshMove 18s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes meshMove {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-5%, 3%) scale(1.05); }
}

/* ========== FORM CARD (Glass) ========== */
.form-card,
.login-card {
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 24px;
    padding: 44px 40px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow), 0 0 0 1px var(--border-strong);
    border: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

.form-card h1,
.login-card h1 {
    font-size: 1.85rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-align: center;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 0%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-card .subtitle,
.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 0.95rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 13px 16px;
    background: rgba(10, 10, 15, 0.6);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(10, 10, 15, 0.85);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-group input::placeholder {
    color: #5a5668;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b8798' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-group select option {
    background: #1a1a28;
    color: var(--text);
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, #7c5cfc 0%, #5b3fd4 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px var(--primary-glow);
    filter: brightness(1.08);
}

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

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: white;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* ========== ERROR ========== */
.error-msg {
    background: rgba(244, 63, 94, 0.12);
    color: #fda4af;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid rgba(244, 63, 94, 0.25);
}

/* ========== CHAT UI ========== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 820px;
    margin: 0 auto;
    background: var(--bg);
    position: relative;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 180px;
    background: radial-gradient(ellipse 80% 100% at 50% 0%, rgba(124, 92, 252, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.chat-header {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.chat-header .avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #7c5cfc, #00e5c0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.chat-header .avatar img {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    object-fit: cover;
}

.chat-header .info h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: -0.02em;
}

.chat-header .info .status {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header .info .status.online::before {
    content: '';
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.message {
    display: flex;
    gap: 10px;
    max-width: 78%;
    animation: msgIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.agent {
    align-self: flex-start;
}

.message .avatar {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
    margin-top: 2px;
}

.message.user .avatar {
    background: linear-gradient(135deg, #7c5cfc, #5b3fd4);
}

.message.agent .avatar {
    background: linear-gradient(135deg, #00e5c0, #00b894);
}

.message .avatar img {
    width: 100%;
    height: 100%;
    border-radius: 11px;
    object-fit: cover;
}

.message .bubble {
    padding: 11px 15px;
    border-radius: 18px;
    position: relative;
}

.message.user .bubble {
    background: var(--user-bubble);
    border-bottom-right-radius: 5px;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.message.agent .bubble {
    background: var(--agent-bubble);
    border: 1px solid var(--border-strong);
    border-bottom-left-radius: 5px;
}

.message .bubble .text {
    word-break: break-word;
    white-space: pre-wrap;
    font-size: 0.93rem;
    line-height: 1.5;
}

.message .bubble .time {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 5px;
    text-align: right;
}

.message.agent .bubble .time {
    color: var(--text-muted);
}

/* Typing indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 12px 18px;
    background: var(--agent-bubble);
    border-radius: 18px;
    border: 1px solid var(--border-strong);
    gap: 5px;
    margin-left: 44px;
}

.typing-indicator.active {
    display: flex;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    animation: bounce 1.35s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.3s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.15s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat input */
.chat-input-area {
    padding: 14px 18px 18px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.chat-input-area textarea {
    flex: 1;
    padding: 13px 16px;
    background: rgba(10, 10, 15, 0.7);
    border: 1.5px solid var(--border-strong);
    border-radius: 14px;
    color: var(--text);
    font-size: 0.93rem;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.chat-input-area .send-btn {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, #7c5cfc, #5b3fd4);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.2s;
    box-shadow: 0 4px 16px var(--primary-glow);
    flex-shrink: 0;
}

.chat-input-area .send-btn:hover {
    transform: scale(1.06);
    filter: brightness(1.1);
}

.chat-input-area .send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ========== ADMIN LAYOUT ========== */
.admin-layout {
    display: flex;
    height: 100vh;
    background: var(--bg);
}

.sidebar {
    width: 290px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(124, 92, 252, 0.08) 0%, transparent 100%);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-header .agent-info {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.sidebar-nav {
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-nav a {
    padding: 11px 14px;
    border-radius: 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(124, 92, 252, 0.2), rgba(124, 92, 252, 0.08));
    color: #c4b5fd;
    box-shadow: inset 3px 0 0 var(--primary);
}

.conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conv-item {
    padding: 13px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 3px;
    border: 1px solid transparent;
}

.conv-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.conv-item.active {
    background: rgba(124, 92, 252, 0.12);
    border-color: rgba(124, 92, 252, 0.3);
}

.conv-item .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.conv-item .name {
    font-weight: 600;
    font-size: 0.92rem;
}

.conv-item .time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.conv-item .preview {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-item .badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    margin-top: 5px;
}

.badge-waiting {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.badge-active {
    background: rgba(0, 229, 192, 0.12);
    color: var(--accent);
}

.badge-closed {
    background: rgba(139, 135, 152, 0.15);
    color: var(--text-muted);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.empty-state svg {
    width: 72px;
    height: 72px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    padding: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 13px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

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

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg2);
    border-radius: 20px;
    padding: 28px;
    width: 90%;
    max-width: 440px;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
}

.modal h3 {
    margin-bottom: 20px;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    justify-content: flex-end;
}

/* Support type badges */
.type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.type-general { background: rgba(124, 92, 252, 0.15); color: #c4b5fd; }
.type-game_download { background: rgba(0, 229, 192, 0.12); color: #5eead4; }
.type-game_problem { background: rgba(244, 63, 94, 0.12); color: #fda4af; }
.type-function_help { background: rgba(96, 165, 250, 0.12); color: #93c5fd; }
.type-other { background: rgba(139, 135, 152, 0.15); color: #a8a4b5; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Responsive */
@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 42vh;
    }
    .message {
        max-width: 90%;
    }
    .form-card,
    .login-card {
        padding: 32px 24px;
        border-radius: 20px;
    }
    .chat-header .avatar {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }
}
