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

:root {
    --primary-color: #1389FE;
    --secondary-color: #E9E8EB;
    --bg-dark: #050505;
    --glass-bg: #111;
    --glass-border: transparent;
    --text-main: #ffffff;
    --text-muted: #666;
    --accent: #1389FE;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chat-container {
    width: 100%;
    max-width: 500px;
    height: 80vh;
    background: var(--glass-bg);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.header-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    transition: color 0.2s;
}

.header-btn:hover {
    color: var(--primary-color);
}

.avatar {
    width: 45px;
    height: 45px;
    background: var(--primary-color);
    background-image: url('../../public/assets/support.png');
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.status-info h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.status {
    font-size: 0.8rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 5px;
}

.status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.chat-link {
    color: #1389FE;
    text-decoration: underline;
    font-weight: 500;
}

.chat-link:hover {
    color: #00e5ff;
}

.highlight-code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

.message.bot .highlight-code, .message.human .highlight-code {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

.close-btn {
    background: #ff4d4d !important;
    color: white !important;
    padding: 8px 15px !important;
    border-radius: 20px !important;
    font-size: 0.85rem !important;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #ff3333 !important;
    transform: scale(1.05);
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

.msg-label {
    font-size: 0.65rem;
    font-weight: 800;
    margin-bottom: 4px;
    opacity: 0.6;
    letter-spacing: 0.05rem;
    text-transform: uppercase;
}

.timestamp {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
    align-self: flex-end;
}

.message.bot .timestamp, .message.human .timestamp {
    color: rgba(0, 0, 0, 0.4);
}

.admin-chat .message.user .timestamp {
    color: rgba(0, 0, 0, 0.4);
}

.admin-chat .message.human .timestamp,
.admin-chat .message.bot .timestamp {
    color: rgba(255, 255, 255, 0.6);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.bot, .message.human {
    background: var(--secondary-color);
    color: #1a1a1a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.user {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.option-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent);
}

.chat-input-area {
    padding: 20px;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background: #1a1a1a;
    border: none;
    border-radius: 12px;
    padding: 12px 15px;
    color: var(--text-main);
    outline: none;
}

.chat-input:focus {
    border-color: var(--accent);
}

.send-btn {
    background: var(--primary-color);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Admin Dashboard Styles */
.admin-container {
    max-width: 1200px;
    width: 95%;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
}

.tickets-sidebar {
    background: var(--glass-bg);
    border-radius: 24px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.ticket-item {
    padding: 15px;
    cursor: pointer;
    border-bottom: 1px solid #1a1a1a;
    transition: background 0.2s;
}

.ticket-item:hover {
    background: #111;
}

.ticket-item.active {
    background: #1a1a1a;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.ticket-item h3 {
    font-size: 0.95rem;
    margin: 0;
    color: white;
}

.ticket-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.last-msg {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

/* Inverted bubbles for Admin View (Sender is Human) */
.admin-chat .message.user {
    align-self: flex-start;
    background: var(--secondary-color);
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 18px;
}

.admin-chat .message.human {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom: none;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 18px;
}

.admin-chat .message.bot {
    align-self: flex-end;
    background: #FF5100;
    color: white;
    border-bottom: none;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 18px;
}

/* Auth Overlay Styles */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-card {
    background: #111;
    padding: 30px;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-card h2 {
    margin-bottom: 10px;
}

.auth-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.auth-tabs button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 10px;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-tabs button.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

#auth-form, #admin-auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#auth-form input, #admin-auth-form input {
    background: #1a1a1a;
    border: 1px solid #222;
    padding: 14px 18px;
    border-radius: 14px;
    color: white;
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

#auth-form input:focus, #admin-auth-form input:focus {
    border-color: var(--primary-color);
}

#auth-form button, #admin-auth-form button {
    background: var(--primary-color);
    border: none;
    padding: 14px;
    border-radius: 14px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: opacity 0.2s;
}

#auth-form button:hover, #admin-auth-form button:hover {
    opacity: 0.9;
}

.error-msg {
    color: #ef4444 !important;
    margin-top: 15px;
    font-size: 0.8rem;
}

/* Responsive Mobile Styles */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
    }

    .chat-container {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .admin-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .tickets-sidebar {
        height: 300px;
    }

    .admin-chat {
        height: 70vh;
        border-radius: 0;
    }
}
