@import 'variables.css';

/* --- RESET & GLOBAL --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
}

/* --- ADMIN DASHBOARD LAYOUT --- */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--primary-color);
    background-image: linear-gradient(135deg, var(--primary-color) 0%, #064e3b 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
    font-family: 'Segoe UI', sans-serif;
}

/* Sidebar Header (Profile) */
.sidebar-header {
    padding: 30px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.profile-icon {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 1.1em;
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-weight: 700;
    font-size: 0.95em;
    color: white;
    letter-spacing: 0.5px;
}

.profile-role {
    font-size: 0.75em;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Sidebar Scroll Area */
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* Sections */
.nav-section {
    margin-bottom: 25px;
    padding: 0 25px;
}

.nav-label {
    display: block;
    font-size: 0.75em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

.nav-menu {
    list-style: none;
    padding: 0;
}

.nav-menu li {
    margin-bottom: 5px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95em;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.nav-menu a.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--accent-color);
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-menu a.active::after {
    content: '•';
    color: var(--accent-color);
    font-size: 1.5em;
    line-height: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-footer .nav-menu a {
    color: #fca5a5;
}

.sidebar-footer .nav-menu a:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fecaca;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 30px;
    background: var(--bg-body);
    transition: all 0.3s;
}

/* --- COMPONENTS --- */

/* Top Bar */
.top-bar {
    background: var(--bg-card);
    padding: 15px 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.user-info {
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    opacity: 0.8;
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--text-main);
}

/* Content Panel */
.content-section {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.content-section h2 {
    margin-bottom: 25px;
    color: var(--primary-color);
    font-weight: 600;
    border-bottom: 2px solid var(--bg-body);
    padding-bottom: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.95em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    transition: var(--transition);
    background: #f8fafc;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85em;
}

.btn-block {
    width: 100%;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead {
    background: var(--bg-body);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #ffedd5;
}

.badge-approved {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #d1fae5;
}

.badge-rejected {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fee2e2;
}

.badge-checked_out {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #dbeafe;
}

.badge-returned {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.badge-admin,
.badge-high {
    background: #ef4444;
    color: white;
    border: 1px solid #f87171;
}

.badge-user,
.badge-normal {
    background: #3b82f6;
    color: white;
    border: 1px solid #60a5fa;
}

/* Utilities */
.text-danger {
    color: #dc2626;
    font-weight: bold;
}

.text-success {
    color: #059669;
    font-weight: bold;
}

.text-muted {
    color: #64748b;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    background: #333;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #10b981;
}

.toast-error {
    background: #ef4444;
}

/* Mobile Sidebar Toggle */
.menu-toggle {
    display: none;
    background: transparent;
    color: var(--primary-color);
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 1.5em;
}

@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .menu-toggle {
        display: block;
    }

    .sidebar {
        left: -260px;
        transition: left 0.3s;
    }

    .sidebar.active {
        left: 0;
    }
}

/* --- CMS STYLES (Content Management) --- */
.cms-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 15px;
}

.cms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.cms-card {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 20px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.cms-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-light);
}

.cms-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
}

.delete-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
    z-index: 10;
}

.delete-btn:hover {
    opacity: 1;
    background: #dc2626;
}

.page-header h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 25px;
}

/* --- PUBLIC LANDING PAGE STYLES (RESTORED) --- */
.landing-nav {
    background: var(--primary-color);
    color: white;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.landing-nav .logo h1 {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin: 0;
    line-height: 1;
}

.landing-nav .logo span {
    font-size: 0.8rem;
    opacity: 0.9;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--accent-color);
}

.btn-nav {
    background: var(--accent-color);
    color: white !important;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.btn-nav:hover {
    background: var(--accent-hover);
}

.landing-hero {
    height: 60vh;
    min-height: 400px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 120, 87, 0.85);
    /* Green Overlay */
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-content h1 {
    font-size: 3rem;
    margin: 10px 0 20px;
    color: var(--accent-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 1rem;
    opacity: 0.9;
}

.hero-buttons {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 1.1rem;
}

.btn-outline-light {
    border: 2px solid white;
    color: white;
    text-decoration: none;
    padding: 10px 25px;
    border-radius: 8px;
}

.btn-outline-light:hover {
    background: white;
    color: var(--primary-color);
}

.announcement-bar {
    background: #1e293b;
    color: white;
    padding: 10px 0;
    overflow: hidden;
    white-space: nowrap;
}

.announcement-bar .container {
    display: flex;
    align-items: center;
    overflow: hidden;
    /* Ensure container clips the scroll */
}

.announcement-bar .label {
    font-weight: bold;
    color: var(--accent-color);
    margin-right: 15px;
    z-index: 10;
    flex-shrink: 0;
}

.marquee-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.scrolling-text {
    display: inline-block;
    padding-left: 100%;
    /* Start from right edge */
    animation: scroll 25s linear infinite;
    white-space: nowrap;
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

.section-content {
    padding: 60px 0;
    background: #f8fafc;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.grid-3-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.section-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.section-title .line {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--accent-color);
}

.card-modern {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid #f1f5f9;
    transition: var(--transition);
}

.card-modern:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-img {
    height: 160px;
    background-color: #e2e8f0;
    background-size: cover;
    background-position: center;
}

.card-body {
    padding: 20px;
    position: relative;
}

.date-badge {
    position: absolute;
    top: -30px;
    right: 20px;
    background: white;
    padding: 8px 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--accent-color);
}

.date-badge .day {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    line-height: 1;
}

.date-badge .month {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-info h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

.bank-card {
    background: linear-gradient(135deg, var(--primary-color), #065f46);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-top: 15px;
    box-shadow: 0 4px 10px rgba(4, 120, 87, 0.2);
}

.bank-card h4 {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.acc-no {
    font-size: 1.4rem;
    font-weight: bold;
    margin: 5px 0;
    letter-spacing: 1px;
    display: block;
}

.sidebar-news .news-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #e2e8f0;
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
}

.sidebar-news .news-item.high-priority {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.landing-footer {
    background: #1e293b;
    color: rgba(255, 255, 255, 0.6);
    padding: 40px 0;
    text-align: center;
    font-size: 0.9rem;
    margin-top: 60px;
}

/* --- AUTH PAGES (Login/Register) --- */
.split-auth-container {
    display: flex;
    min-height: 100vh;
    background: white;
}

.auth-left {
    flex: 1;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.auth-left img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    /* Slight fade to show green theme */
    mix-blend-mode: overlay;
    /* Blend with green background */
}

/* Fallback/Overlay pattern for left side */
.auth-left::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.1) 75%, transparent 75%, transparent);
    background-size: 30px 30px;
    pointer-events: none;
}

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: white;
}

.login-form-wrapper {
    width: 100%;
    max-width: 400px;
}

.login-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* Modern Form Elements in Auth */
.modern-form .form-group label {
    color: var(--text-main);
    font-weight: 600;
}

.modern-form input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 5px;
    transition: all 0.3s;
    background: #f8fafc;
}

.modern-form input:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
    outline: none;
}

.btn-modern {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-modern:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(4, 120, 87, 0.3);
}

.auth-links {
    margin-top: 25px;
    text-align: center;
    font-size: 0.9rem;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .split-auth-container {
        flex-direction: column;
    }

    .auth-left {
        display: none;
        /* Hide image on mobile for cleaner look */
    }
}

/* --- WHATSAPP CHAT INTERFACE --- */

:root {
    --wa-header-bg: #f0f2f5;
    --wa-chat-bg: #efeae2;
    --wa-sent-bg: #d9fdd3;
    --wa-received-bg: #ffffff;
    --wa-border: #d1d7db;
    --wa-input-bg: #ffffff;
}

/* Chat Container */
.chat-container {
    background: #fff;
    border-radius: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    /* Adjust based on top bar + padding */
    border: 1px solid var(--wa-border);
    max-width: 1000px;
    margin: 0 auto;
    overflow: hidden;
}

/* Header */
.chat-header {
    background-color: var(--wa-header-bg);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--wa-border);
    height: 60px;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: #dfe5e7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 1.2em;
    overflow: hidden;
}

.chat-details {
    display: flex;
    flex-direction: column;
}

.chat-name {
    font-size: 1em;
    color: #111b21;
    font-weight: 500;
}

.chat-status {
    font-size: 0.8em;
    color: #667781;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    color: #54656f;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Chat Main Area */
.chat-main-area {
    flex: 1;
    background-color: var(--wa-chat-bg);
    background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png");
    /* Simple dark opacity pattern */
    background-repeat: repeat;
    background-size: 400px;
    /* Adjust size */
    opacity: 0.95;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 5%;
    /* Side padding for responsive */
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Messages */
.message {
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    max-width: 65%;
    font-size: 0.95em;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
    color: #111b21;
}

.message.sent {
    align-self: flex-end;
    background-color: var(--wa-sent-bg);
    border-top-right-radius: 0;
}

.message.received {
    align-self: flex-start;
    background-color: var(--wa-received-bg);
    border-top-left-radius: 0;
}

/* Tails (pseudo-elements) - Optional for simplicity, but adds detail */
.message.sent::after {
    content: "";
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top-color: var(--wa-sent-bg);
    border-left-color: var(--wa-sent-bg);
    border-bottom: 0;
    border-right: 0;
}

.message.received::after {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top-color: var(--wa-received-bg);
    border-right-color: var(--wa-received-bg);
    border-bottom: 0;
    border-left: 0;
    transform: scaleX(-1);
    /* Mirror for left side */
}

.chat-date {
    display: block;
    font-size: 0.7em;
    color: rgba(0, 0, 0, 0.45);
    text-align: right;
    margin-top: 2px;
    float: right;
    margin-left: 10px;
    position: relative;
    top: 4px;
}

/* Input Area */
.chat-input-area {
    background-color: var(--wa-header-bg);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--wa-border);
}

.chat-input {
    flex: 1;
    border: none;
    padding: 12px 15px;
    border-radius: 8px;
    background: var(--wa-input-bg);
    font-size: 0.95em;
    outline: none;
}

.chat-input:focus {
    background: #fff;
}

.send-btn {
    background: transparent;
    border: none;
    color: #54656f;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.send-btn:hover {
    color: #00a884;
    /* WhatsApp green */
}

/* Scrollbar */
.chat-messages-area::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-area::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - 80px);
        /* Adjust for mobile */
        border: none;
        max-width: 100%;
    }

    .main-content {
        padding: 0;
        /* Full width on mobile */
    }

    .top-bar {
        display: none;
        /* Hide default top bar in chat mode for better immersion or keep concise */
        margin-bottom: 0;
    }

    .chat-messages-area {
        padding: 10px;
    }
}

/* --- ADMIN CHAT SPECIFIC --- */

.chat-admin-wrapper {
    display: flex;
    height: calc(100vh - 140px);
    background: #fff;
    border: 1px solid var(--wa-border);
    max-width: 1400px;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-sidebar-panel {
    width: 30%;
    /* Or 350px-400px */
    min-width: 300px;
    border-right: 1px solid var(--wa-border);
    display: flex;
    flex-direction: column;
    background: #fff;
}

.chat-main-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--wa-chat-bg);
}

/* Sidebar Search */
.chat-search-bar {
    padding: 10px;
    border-bottom: 1px solid var(--wa-border);
    background: #fff;
}

.search-input-wrapper {
    background: #f0f2f5;
    border-radius: 8px;
    padding: 7px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input-wrapper input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 0.9em;
}

/* User List Items */
.user-list-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f2f5;
    transition: background 0.2s;
}

.user-list-item:hover {
    background: #f5f6f6;
}

.user-list-item.active {
    background: #f0f2f5;
}

.user-list-info {
    flex: 1;
    margin-left: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-list-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

.user-list-name {
    font-weight: 500;
    color: #111b21;
    font-size: 1em;
}

.user-list-time {
    font-size: 0.75em;
    color: #667781;
}

.user-list-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-list-msg {
    color: #667781;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.unread-badge {
    background: #25d366;
    color: white;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* Placeholder */
.chat-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    border-bottom: 6px solid #25d366;
    /* Accent line */
}

.placeholder-content {
    text-align: center;
    color: #41525d;
}

.placeholder-img {
    font-size: 5em;
    margin-bottom: 20px;
    display: inline-block;
    color: #aebac1;
}

.placeholder-content h2 {
    font-weight: 300;
    margin-bottom: 15px;
    color: #41525d;
}

.placeholder-content p {
    font-size: 0.9em;
    color: #667781;
}

.mobile-back-btn {
    display: none;
    font-size: 1.2em;
    margin-right: 10px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .chat-admin-wrapper {
        height: calc(100vh - 80px);
        border: none;
        overflow: hidden;
    }

    .chat-sidebar-panel {
        width: 100%;
        border-right: none;
    }

    .chat-main-window {
        display: none;
        /* Initially hidden on mobile */
        width: 100%;
    }

    .mobile-back-btn {
        display: block;
    }
}

/* --- ADMIN SIDEBAR UPDATE --- */
.chat-filters {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.chat-filter-chip {
    background: #f0f2f5;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85em;
    color: #54656f;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.chat-filter-chip:hover {
    background: #d9fdd3;
    /* Light green hover */
}

.chat-filter-chip.active {
    background: #e7f8f5;
    /* Active chip color */
    color: #008069;
    font-weight: 500;
}

.chat-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.chat-archived-row {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-bottom: 1px solid #f0f2f5;
    color: #111b21;
}

.chat-archived-row:hover {
    background: #f5f6f6;
}

/* Enhancements for user list items to match dense look */
.user-list-item {
    padding: 12px 15px;
    /* Increase padding properly */
}

.chat-avatar {
    width: 49px;
    height: 49px;
    font-size: 1.5em;
    /* Bigger avatar */
}

.user-list-msg {
    color: #667781;
    font-size: 0.9em;
    margin-top: 2px;
}

.user-list-name {
    font-size: 1.05em;
    color: #111b21;
}

.user-list-time {
    font-size: 0.75em;
    color: #667781;
}