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

:root {
    --primary-color: #2b6cb0;
    --primary-gradient: linear-gradient(135deg, #2b6cb0 0%, #1a365d 100%);
    --primary-hover: #1e4e8c;
    
    /* Glassmorphism settings */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    
    --sidebar-bg: rgba(15, 23, 42, 0.85); /* Dark transparent */
    --sidebar-text: #ffffff;
    --sidebar-text-muted: rgba(255, 255, 255, 0.6);
    
    --bg-color: #f1f5f9; /* Fallback */
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border-color: rgba(226, 232, 240, 0.8);
    
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    /* Animated Gradient Background */
    background: linear-gradient(-45deg, #e2e8f0, #ffffff, #f8fafc, #cbd5e1);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 1400px;
    height: calc(100vh - 40px);
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow);
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 32px 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 40px;
    padding-left: 8px;
    background: -webkit-linear-gradient(45deg, #60a5fa, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: var(--sidebar-text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateX(5px);
}

.nav-item i { font-size: 1.2rem; }

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow: hidden;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255,255,255,0.4);
}

.search-container {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 14px 20px 14px 44px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.6);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    background: #ffffff;
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.user-actions { display: flex; align-items: center; gap: 24px; }
.user-profile { display: flex; align-items: center; gap: 12px; }

.avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(43, 108, 176, 0.3);
}

.icon-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.3rem; cursor: pointer; transition: all 0.2s;
}
.icon-btn:hover { color: var(--primary-color); transform: scale(1.1); }

/* Dashboard Body & Cards */
.dashboard-body { padding: 40px; overflow-y: auto; flex: 1; }

.section-title {
    font-size: 1rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-muted); font-weight: 800; margin-bottom: 20px;
}

.cards-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px; margin-bottom: 48px;
}

.card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md), 0 15px 30px rgba(0,0,0,0.05);
}

.card-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    box-shadow: 0 10px 20px rgba(43, 108, 176, 0.3);
}

.card-primary h3 { color: rgba(255,255,255,0.8) !important; }

/* Buttons & Inputs */
.btn-primary {
    padding: 14px 28px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(43, 108, 176, 0.3);
    transition: all 0.3s ease;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(43, 108, 176, 0.4);
}

.form-group { margin-bottom: 24px; text-align: left; }
.form-label { display: block; margin-bottom: 8px; font-size: 0.95rem; font-weight: 700; color: var(--text-dark); }
.form-control {
    width: 100%; padding: 14px 16px;
    background: rgba(255,255,255,0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit; font-size: 1rem; outline: none;
    transition: all 0.3s ease;
}
.form-control:focus {
    background: #ffffff;
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Chat Layout */
.chat-container {
    display: flex; height: calc(100vh - 105px); margin: -40px;
    background: rgba(255,255,255,0.5); backdrop-filter: blur(10px);
}
.chat-sidebar {
    width: 380px; border-right: 1px solid rgba(0,0,0,0.05);
    display: flex; flex-direction: column; background: rgba(255,255,255,0.7);
}
.chat-sidebar-header { padding: 24px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.chat-filters { display: flex; gap: 8px; margin-top: 16px; overflow-x: auto; padding-bottom: 4px; }
.filter-btn {
    border: none; background: rgba(0,0,0,0.05); padding: 8px 16px;
    border-radius: var(--radius-full); font-size: 0.85rem; font-weight: 700;
    cursor: pointer; color: var(--text-muted); transition: all 0.2s;
}
.filter-btn.active, .filter-btn:hover { background: var(--text-dark); color: white; }

.chat-list { flex: 1; overflow-y: auto; }
.chat-list-item {
    padding: 16px 24px; border-bottom: 1px solid rgba(0,0,0,0.03);
    cursor: pointer; display: flex; gap: 16px; transition: all 0.2s;
}
.chat-list-item:hover, .chat-list-item.active { background: rgba(255,255,255,0.9); }
.chat-list-info { flex: 1; overflow: hidden; }
.chat-list-name { font-weight: 700; font-size: 1rem; margin-bottom: 6px; display: flex; justify-content: space-between; }
.chat-list-time { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.chat-list-msg { font-size: 0.9rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500;}

.chat-main { flex: 1; display: flex; flex-direction: column; background: transparent; }
.chat-header {
    padding: 20px 32px; background: rgba(255,255,255,0.6);
    border-bottom: 1px solid rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center;
}
.chat-messages { flex: 1; padding: 32px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }

/* iMessage style bubbles */
.msg-bubble {
    max-width: 65%; padding: 12px 18px; font-size: 0.95rem; line-height: 1.5;
    position: relative; font-weight: 500; box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.msg-incoming {
    background: #ffffff; color: var(--text-dark); align-self: flex-start;
    border-radius: 20px 20px 20px 4px; border: 1px solid rgba(0,0,0,0.05);
}
.msg-outgoing {
    background: var(--primary-gradient); color: white; align-self: flex-end;
    border-radius: 20px 20px 4px 20px;
}
.msg-time { display: block; font-size: 0.75rem; margin-top: 6px; opacity: 0.7; text-align: right; font-weight: 600;}

.msg-note {
    background: rgba(254, 252, 191, 0.9); border: 1px solid #f6e05e; color: #744210;
    align-self: center; border-radius: var(--radius-full); font-size: 0.85rem; font-weight: 700;
    padding: 8px 20px; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-sm);
}

.chat-input-area {
    padding: 20px 32px; background: rgba(255,255,255,0.8);
    border-top: 1px solid rgba(0,0,0,0.05); display: flex; gap: 16px; align-items: flex-end;
}
.chat-input {
    flex: 1; border: 1px solid transparent; border-radius: var(--radius-xl);
    padding: 14px 20px; font-family: inherit; font-size: 1rem; resize: none; outline: none;
    background: #f1f5f9; transition: all 0.3s;
}
.chat-input:focus { background: white; border-color: #93c5fd; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1); }
.chat-send-btn {
    width: 48px; height: 48px; border-radius: 50%; background: var(--primary-gradient);
    color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 4px 10px rgba(43,108,176,0.3);
}
.chat-send-btn:hover { transform: scale(1.1) rotate(5deg); box-shadow: 0 6px 15px rgba(43,108,176,0.4); }

/* Login Page Styles */
.login-wrapper {
    width: 100%; max-width: 420px;
    background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow); padding: 48px; text-align: center;
}
.login-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 72px; height: 72px; background: var(--primary-gradient); color: white;
    border-radius: var(--radius-lg); font-size: 2.2rem; margin-bottom: 24px;
    box-shadow: 0 10px 20px rgba(43,108,176,0.3);
}
.login-title { font-size: 1.75rem; font-weight: 800; margin-bottom: 8px; color: var(--text-dark); }
.login-subtitle { color: var(--text-muted); margin-bottom: 32px; font-size: 1rem; font-weight: 500; }

/* Utilities */
.d-flex { display: flex; } .justify-between { justify-content: space-between; } .align-center { align-items: center; }

/* Mobile Responsive */
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; color: var(--text-dark); margin-right: 16px; cursor: pointer; }
.mobile-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; backdrop-filter: blur(4px); }
.mobile-overlay.active { display: block; }

@media (max-width: 768px) {
    body { padding: 0; background: #f1f5f9; }
    .app-container { border-radius: 0; height: 100vh; border: none; }
    .sidebar { position: fixed; left: -280px; top: 0; bottom: 0; z-index: 1000; transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 0; }
    .sidebar.mobile-open { left: 0; }
    .mobile-menu-btn { display: block; }
    .topbar { padding: 16px 20px; }
    .dashboard-body { padding: 20px; }
    .chat-container { flex-direction: column; margin: -20px; height: calc(100vh - 73px); }
    .chat-sidebar { width: 100%; height: 40%; border-right: none; border-bottom: 1px solid var(--border-color); }
    .chat-main { height: 60%; }
}

/* Data Tables */
.data-table {
    width: 100%; border-collapse: collapse; margin-top: 20px;
    background: rgba(255,255,255,0.7); backdrop-filter: blur(10px);
    border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
    border: 1px solid var(--glass-border);
}
.data-table th, .data-table td { padding: 16px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.05); }
.data-table th { background-color: rgba(255,255,255,0.9); font-weight: 700; color: var(--text-dark); font-size: 0.95rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background-color 0.2s; }
.data-table tbody tr:hover { background-color: rgba(255,255,255,0.95); transform: scale(1.005); }
