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

html {
    --bg-primary: #FAF5FF;
    --bg-secondary: #F7F3FD;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(124, 58, 237, 0.15);
    --glass-surface: rgba(255, 255, 255, 0.5);
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --accent-primary: #7C3AED;
    --accent-hover: #6366F1;
    --gradient-1: linear-gradient(135deg, #7C3AED 0%, #EC4899 100%);
    --gradient-bg: radial-gradient(circle at 15% 50%, rgba(124, 58, 237, 0.05), transparent 25%),
                   radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.05), transparent 25%);
    --success: #10b981;
    --danger: #DC2626;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

.dark, :root.dark, html.dark, [data-theme="dark"], .dark body, body.dark {
    --bg-primary: #0B0F19;
    --bg-secondary: #111827;
    --glass-bg: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(124, 58, 237, 0.25);
    --glass-surface: rgba(31, 41, 55, 0.5);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --accent-primary: #8B5CF6;
    --accent-hover: #A78BFA;
    --gradient-1: linear-gradient(135deg, #8B5CF6 0%, #F472B6 100%);
    --gradient-bg: radial-gradient(circle at 15% 50%, rgba(124, 58, 237, 0.15), transparent 30%),
                   radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.15), transparent 30%);
}

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

body {
    font-family: 'Fira Sans', sans-serif;
    background-color: var(--bg-primary);
    background-image: var(--gradient-bg);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Layout */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    border-right: 1px solid var(--glass-border);
    background: var(--glass-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    overflow-y: auto;
}

.brand {
    font-family: 'Fira Code', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item:hover, .nav-item.active {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent-primary);
    transform: translateX(4px);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Background gradient blobs to make it premium */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.15) 0%, rgba(250, 245, 255, 0) 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}
body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.1) 0%, rgba(250, 245, 255, 0) 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

/* Header */
.page-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: relative;
    z-index: 2;
}

.page-title {
    font-family: 'Fira Code', monospace;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--text-primary);
}

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-title {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

th {
    padding: 16px 24px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
}

tr:hover td {
    background: rgba(124, 58, 237, 0.03);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Spring animation effect */
    font-family: inherit;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.btn-secondary:hover {
    background: rgba(124, 58, 237, 0.05);
    transform: translateY(-2px) scale(1.02);
}

/* Login Page Specific */
.login-container {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -260px; /* Offset sidebar */
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    text-align: center;
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.form-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.form-group input:focus {
    border-color: var(--accent-primary);
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge.warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
/* WhatsApp Web Style UI */
.chat-layout {
    display: flex;
    height: calc(100vh - 80px);
    border-radius: 16px;
    overflow: hidden;
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 15px rgba(124, 58, 237, 0.05);
}

.chat-sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.chat-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
    color: var(--text-primary);
    background: var(--glass-surface);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-item:hover {
    background: var(--glass-surface);
}

.chat-item.active {
    background: rgba(124, 58, 237, 0.1);
    border-left: 4px solid var(--accent-primary);
}

.chat-item-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.chat-item-preview {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--glass-surface);
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-surface);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-primary);
}

.msg-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.msg-user {
    align-self: flex-start;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--glass-border);
}

.msg-bot {
    align-self: flex-end;
    background: var(--gradient-1);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-meta {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.empty-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
}
