:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #10b981;
    --gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
}

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

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow: hidden;
    height: 100%;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(circle at bottom right, rgba(168, 85, 247, 0.1), transparent);
}

header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-badge {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 99px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge .dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
}

main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    padding: 2rem;
    border-right: 1px solid var(--glass-border);
    display: none;
    /* Desktop only */
}

@media (min-width: 1024px) {
    .sidebar {
        display: block;
    }
}

.sidebar h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.sidebar p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.info-card {
    background: var(--gradient);
    padding: 1.5rem;
    border-radius: 1rem;
    color: white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.info-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.info-card p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    /* Ensure full height */
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding-right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.message {
    max-width: 80%;
    padding: 1rem 1.5rem;
    border-radius: 1.25rem;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: var(--gradient);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message.system {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    background-clip: padding-box;
    border-bottom-left-radius: 0.25rem;
}

.input-area {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background-clip: padding-box;
    padding: 1rem;
    border-radius: 1.5rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

#chat-form {
    display: flex;
    gap: 1rem;
}

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    padding: 0.5rem;
    outline: none;
}

#send-btn {
    background: var(--gradient);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

#send-btn:hover {
    transform: scale(1.05);
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    justify-content: center;
    align-items: center;
    animation: fadeInModal 0.4s ease-out;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: rgba(30, 41, 59, 0.7);
    padding: 3.5rem;
    border-radius: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(99, 102, 241, 0.1);
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-clip: padding-box;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

.modal-content input {
    width: 100%;
    padding: 1.1rem 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.modal-content input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.modal-content button {
    width: 100%;
    padding: 1.1rem;
    background: var(--gradient);
    border: none;
    border-radius: 1rem;
    color: white;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

.modal-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.3);
}

.modal-content button:active {
    transform: translateY(0);
}

#login-error {
    margin-top: 1.5rem;
    color: #f87171;
    font-size: 0.9rem;
    font-weight: 500;
    min-height: 1.2rem;
}

.header-nav {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1.25rem;
    border-radius: 99px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn.active {
    background: var(--gradient);
    color: white;
    border-color: transparent;
}

.search-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 15px;
    color: white;
    font-size: 0.9rem;
    width: 300px;
    margin-right: 20px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.3);
}

.mini-list {
    line-height: 1.2;
    max-width: 250px;
    white-space: normal;
    word-break: break-word;
}

.view {
    display: none;
    width: 100%;
    flex: 1;
}

.view.active {
    display: flex;
}

/* Admin Styling */
.admin-content {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.action-btn {
    background: var(--gradient);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-top: 1rem;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-muted);
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-area {
    margin-top: 3rem;
    background: #000;
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
}

.log-area pre {
    color: #10b981;
    font-family: monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
}

footer {
    padding: 1rem 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}