:root {
    --primary-color: #25D366;
    --primary-dark: #128C7E;
    --secondary-color: #075E54;
    --bg-color: #f0f2f5;
    --container-bg: #ffffff;
    --text-primary: #111b21;
    --text-secondary: #667781;
    --border-color: #e9edef;
    --danger-color: #ef4444;
    --sidebar-width: 260px;
    --header-height: 70px;
    --transition-speed: 0.3s;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Premium Tokens */
    --accent-purple: #7c3aed;
    --accent-blue: #3b82f6;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow-premium: 0 10px 30px -5px rgba(0, 0, 0, 0.08);
}

/* Premium Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Base Classes */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-speed);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

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

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
}

.p-14 {
    padding: 14px;
}

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

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

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
}

/* Alert */
.alert {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}

/* Login Page */
.login-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-color) 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

.login-header h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--container-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed);
    z-index: 1000;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.sidebar-header .logo i {
    font-size: 24px;
}

.logo img {
    height: 42px;
    width: auto;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.nav-list {
    list-style: none;
}

.nav-title {
    padding: 15px 25px 5px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-weight: 500;
    gap: 15px;
}

.nav-item a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.nav-item:hover a,
.nav-item.active a {
    background: var(--bg-color);
    color: var(--primary-dark);
    border-left: 4px solid var(--primary-color);
    padding-left: 21px;
}

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

/* Top Navbar */
.top-navbar {
    height: var(--header-height);
    background: var(--container-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

.nav-left h2 {
    font-size: 20px;
    font-weight: 600;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    position: relative;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.dropdown-menu {
    position: absolute;
    top: 50px;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s;
}

.user-profile:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 14px;
    transition: background 0.2s;
}

.dropdown-menu a:hover {
    background: var(--bg-color);
}

.dropdown-menu a i {
    margin-right: 10px;
    color: var(--text-secondary);
}

.dropdown-menu hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 5px 0;
}

.text-danger {
    color: var(--danger-color) !important;
}

/* Page Content */
.page-content {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* Dashboard Cards */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--container-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
}

.stat-info h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-info p {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.bg-green {
    background: rgba(37, 211, 102, 0.1);
    color: var(--primary-dark);
}

.bg-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.bg-orange {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.bg-purple {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

/* Responsive */
@media (max-width: 768px) {
    .inbox-container {
        height: calc(100vh - 40px) !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .inbox-sidebar {
        width: 100% !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .inbox-sidebar.hidden-mobile {
        transform: translateX(-100%);
        position: absolute;
    }

    .chat-area {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 2000;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important;
    }

    .chat-area.active-mobile {
        transform: translateX(0);
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-btn {
        display: block;
    }

    .d-md-none {
        display: block;
    }

    .user-name {
        display: none;
    }

    .mobile-back-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #f1f5f9;
        margin-right: 10px;
    }
}

.d-md-none {
    display: none;
}

/* Premium Notifications */
.notification-wrapper {
    position: relative;
    margin-right: 20px;
}

/* Header Re-styling with Linear Elements */
.header-divider {
    width: 1px;
    height: 30px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.06), transparent);
    margin: 0 5px;
}

.top-navbar,
.admin-topbar {
    position: relative;
    overflow: visible !important;
}

.top-navbar::after,
.admin-topbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            rgba(37, 211, 102, 0) 0%,
            rgba(37, 211, 102, 0.3) 50%,
            rgba(37, 211, 102, 0) 100%);
}

.admin-topbar::after {
    background: linear-gradient(90deg,
            rgba(124, 58, 237, 0) 0%,
            rgba(124, 58, 237, 0.3) 50%,
            rgba(124, 58, 237, 0) 100%);
}

.nav-icon-btn {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 18px;
    color: #64748b;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon-btn:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.nav-icon-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 20px;
    font-weight: 800;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.4);
    animation: badgePulse 2s infinite;
}

/* Unread Status Badges */
.unread-badge {
    background: linear-gradient(135deg, #FF4B2B, #FF416C) !important;
    color: white !important;
    font-weight: 800 !important;
    box-shadow: 0 3px 6px rgba(255, 75, 43, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    padding: 0 4px;
}

.unread-badge-pulsar {
    animation: unreadPulse 2.5s infinite ease-in-out;
}

@keyframes unreadPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 3px 6px rgba(255, 75, 43, 0.3);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 5px 15px rgba(255, 75, 43, 0.5);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 3px 6px rgba(255, 75, 43, 0.3);
    }
}

.unread-badge-pulsar {
    animation: unreadPulse 2.5s infinite;
    background: linear-gradient(135deg, #25D366, #128C7E) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.4);
}

@keyframes unreadPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(37, 211, 102, 0.4);
    }

    50% {
        transform: scale(1.12);
        box-shadow: 0 4px 15px rgba(37, 211, 102, 0.6);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(37, 211, 102, 0.4);
    }
}

.notification-dropdown {
    position: absolute;
    top: 60px;
    right: -10px;
    width: 380px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.6);
    visibility: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1001;
    overflow: hidden;
}

.notification-dropdown.active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.notification-header {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
}

.notification-header span {
    font-weight: 800;
    font-size: 17px;
    color: #1e293b;
}

.mark-read-btn {
    background: #f1f5f9;
    border: none;
    color: #64748b;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.mark-read-btn:hover {
    background: var(--primary-color);
    color: white;
}

.notification-list {
    max-height: 420px;
    overflow-y: auto;
    padding: 10px;
}

.notification-item {
    padding: 14px 16px;
    display: flex;
    gap: 14px;
    border-radius: 14px;
    margin-bottom: 8px;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateX(4px);
    border-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.notification-item.unread {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border-color: rgba(37, 211, 102, 0.1);
}

.notification-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.notification-icon.info {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #3b82f6;
}

.notification-icon.warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #f59e0b;
}

.notification-icon.critical {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #ef4444;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 700;
    font-size: 14px;
    color: #334155;
    margin-bottom: 2px;
}

.notification-message {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 6px;
}

.notification-time {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.notification-empty {
    padding: 50px 20px;
    text-align: center;
    color: #94a3b8;
}

.notification-empty i {
    font-size: 40px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.notification-footer {
    padding: 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.4);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.notification-footer a {
    display: inline-block;
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #1e293b, #334155);
    color: white;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    transition: transform 0.2s;
}

.notification-footer a:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

/* History Page refinements */
.header-banner {
    padding: 24px 0;
}

.content-header h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #1e293b, #475569);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.premium-card {
    background: white;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.status-glow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-glow-unread {
    background: #dcfce7;
    color: #166534;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.15);
}

.status-glow-read {
    background: #f1f5f9;
    color: #64748b;
}

/* Premium Conversation List Items */
.conv-item {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    gap: 15px;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.conv-item:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: translateX(4px);
}

.conv-item.active {
    background: white;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
}

.conv-item-avatar {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Premium Chat Bubbles */
.chat-messages {
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-size: 450px;
    background-color: #efeae2;
    background-blend-mode: overlay;
    padding: 30px !important;
    opacity: 0.97;
    /* Increase opacity of the container itself to wash out the doodle slightly more */
}

.msg-bubble {
    max-width: 75%;
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
    animation: msgAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 8px;
}

@keyframes msgAppear {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }

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

.msg-inbound {
    align-self: flex-start;
    background: white;
    color: #111b21;
    border-bottom-left-radius: 4px;
}

.msg-inbound::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 20px;
    height: 20px;
    background: white;
    clip-path: polygon(100% 0, 0 100%, 100% 100%);
    z-index: -1;
}

.msg-outbound {
    align-self: flex-end;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-outbound::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #128C7E;
    clip-path: polygon(0 0, 0 100%, 100% 100%);
    z-index: -1;
}

.msg-meta {
    font-size: 11px;
    margin-top: 6px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-weight: 500;
}

/* Filter Buttons Modern */
.filter-btn {
    white-space: nowrap;
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover {
    background: #f8fafc;
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}