:root {
    --primary: #1e3a8a;
    --primary-dark: #1e1b4b;
    --accent: #b45309;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    transition: all 0.2s ease;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Auth Pages */
.auth-page {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e1b4b 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: var(--primary);
    margin: 0;
    font-size: 32px;
    font-weight: 700;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.flash-messages {
    margin-bottom: 20px;
}

.flash-message {
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    margin-bottom: 10px;
}

.flash-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.flash-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.btn-delete {
    background: #fee2e2;
    color: #991b1b;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.btn-delete:hover {
    background: #fecaca;
}

/* Main App Container */
.container {
    width: 95%;
    max-width: 1000px;
    background: white;
    height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border-radius: 20px;
    overflow: hidden;
}

header {
    background: var(--primary);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid var(--accent);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    width: 45px;
    height: 45px;
    object-fit: contain;
    border-radius: 8px;
    background: white;
    padding: 2px;
}

.logo-text h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.logo-text span { font-size: 11px; opacity: 0.8; text-transform: uppercase; letter-spacing: 1px; display: block; }

.auth-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 20px;
    border-radius: 12px;
    background: #f8fafc;
    padding: 5px;
    box-shadow: var(--shadow);
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.update-info { 
    font-size: 11px; 
    opacity: 0.9; 
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

.admin-link {
    color: #fbbf24;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid #fbbf24;
    padding: 4px 10px;
    border-radius: 6px;
}

.admin-link:hover {
    background: #fbbf24;
    color: var(--primary-dark);
}

.badge {
    font-size: 12px;
    background: #fbbf24;
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 10px;
}

.admin-main {
    padding: 40px;
    overflow-y: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th {
    background: #f1f5f9;
    text-align: left;
    padding: 15px;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.admin-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.role-badge {
    background: #e2e8f0;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}

.role-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.status-active {
    color: #10b981;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-active::before {
    content: "";
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
}

.user-info {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-link {
    color: white;
    text-decoration: none;
    background: rgba(255,255,255,0.1);
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 500;
}

.logout-link:hover {
    background: rgba(255,255,255,0.2);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fcfcfd;
}

.chat-box {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.message {
    padding: 16px 20px;
    border-radius: 20px;
    max-width: 85%;
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.bot {
    background: white;
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

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

.input-area {
    padding: 25px 30px;
    background: white;
    border-top: 1px solid var(--border);
}

.input-area form {
    display: flex;
    gap: 15px;
}

.input-area input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    font-size: 15px;
    background: #f8fafc;
}

.input-area input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.05);
}

.input-area button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 25px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
}

.input-area button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.loading { 
    font-style: italic; 
    color: var(--text-muted);
    background: transparent;
    box-shadow: none;
    border: none;
}

/* Scrollbar */
.chat-box::-webkit-scrollbar { width: 6px; }
.chat-box::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* Responsive */
@media (max-width: 640px) {
    .container { height: 100vh; width: 100%; border-radius: 0; }
    header { padding: 15px; flex-direction: column; gap: 15px; text-align: center; }
    .header-right { align-items: center; }
    .message { max-width: 95%; }
}
