/* ========== Root Styles ========== */
:root {
    --primary-color: #00b4d8;
    --secondary-color: #0077b6;
    --accent-yellow: #ffd60a;
    --accent-pink: #ff6eb4;
    --accent-green: #06d6a0;
    --success-color: #06d6a0;
    --danger-color: #ef476f;
    --warning-color: #ffd60a;
    --dark-bg: #023e8a;
    --light-bg: rgba(202, 240, 248, 0.5);
    --card-bg: rgba(255, 255, 255, 0.35);
    --text-dark: #03045e;
    --text-light: #0077b6;
    --border-color: rgba(0, 180, 216, 0.3);
    --shadow: 0 4px 16px rgba(0, 119, 182, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 119, 182, 0.25);
    --glass-bg: rgba(255, 255, 255, 0.3);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: blur(12px);
    --ocean-gradient: linear-gradient(160deg, #48cae4 0%, #00b4d8 30%, #0096c7 60%, #0077b6 100%);
}

body.dark-mode {
    --light-bg: rgba(2, 62, 138, 0.6);
    --card-bg: rgba(0, 119, 182, 0.3);
    --text-dark: #caf0f8;
    --text-light: #90e0ef;
    --border-color: rgba(144, 224, 239, 0.3);
}

/* ========== Auth Pages Styles ========== */
#auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    background: url('a0b46043e9fa6cea6026108b4cc12a3d (1).jpg') center center / cover no-repeat;
    position: relative;
    overflow: hidden;
}

#auth-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 214, 10, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(255, 110, 180, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.auth-page {
    display: none;
    animation: slideIn 0.5s ease;
}

.auth-page.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 119, 182, 0.3), inset 0 1px 0 rgba(255,255,255,0.6);
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 32px;
    color: #03045e;
    margin-bottom: 8px;
    text-shadow: 0 2px 8px rgba(255,255,255,0.5);
}

.auth-logo p {
    color: #0077b6;
    font-size: 14px;
}

.auth-card h2 {
    font-size: 24px;
    margin-bottom: 24px;
    color: #03045e;
    text-align: center;
}

.auth-card .form-group {
    margin-bottom: 16px;
}

.auth-card label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #03045e;
    font-size: 14px;
}

.auth-card input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(0,180,216,0.4);
    border-radius: 12px;
    font-size: 14px;
    background: rgba(255,255,255,0.5);
    color: #03045e;
    transition: all 0.3s ease;
}

.auth-card input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255,255,255,0.75);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.25);
}

.btn-full {
    width: 100%;
    padding: 12px 24px !important;
    margin-top: 16px;
    font-size: 16px;
    font-weight: 600;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    color: var(--text-light);
    font-size: 14px;
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-switch a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.error-message {
    margin-top: 12px;
    padding: 12px;
    background-color: rgba(239, 71, 111, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: 6px;
    color: var(--danger-color);
    font-size: 13px;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    margin-top: 12px;
    padding: 12px;
    background-color: rgba(6, 214, 160, 0.1);
    border: 1px solid var(--success-color);
    border-radius: 6px;
    color: var(--success-color);
    font-size: 13px;
    display: none;
}

.success-message.show {
    display: block;
}

/* ========== Reset & Base Styles ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--ocean-gradient);
    color: var(--text-dark);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ocean animated background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 10% 90%, rgba(255, 214, 10, 0.12) 0%, transparent 35%),
        radial-gradient(ellipse at 90% 10%, rgba(255, 110, 180, 0.12) 0%, transparent 35%),
        radial-gradient(ellipse at 50% 50%, rgba(6, 214, 160, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 180, 216, 0.15) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* Floating bubbles */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle, rgba(255,255,255,0.5) 2px, transparent 2px),
        radial-gradient(circle, rgba(255,255,255,0.35) 3px, transparent 3px),
        radial-gradient(circle, rgba(255,255,255,0.25) 4px, transparent 4px),
        radial-gradient(circle, rgba(255,255,255,0.4) 2px, transparent 2px),
        radial-gradient(circle, rgba(255,255,255,0.3) 5px, transparent 5px);
    background-size: 180px 180px, 250px 250px, 320px 320px, 140px 140px, 400px 400px;
    background-position: 20px 40px, 80px 120px, 160px 60px, 40px 200px, 300px 150px;
    pointer-events: none;
    z-index: 0;
    animation: bubblesFloat 20s linear infinite;
}

@keyframes bubblesFloat {
    0%   { background-position: 20px 40px, 80px 120px, 160px 60px, 40px 200px, 300px 150px; }
    50%  { background-position: 20px -60px, 80px 20px, 160px -40px, 40px 100px, 300px 50px; }
    100% { background-position: 20px -160px, 80px -80px, 160px -140px, 40px 0px, 300px -50px; }
}

/* ========== Dashboard Container ========== */
.dashboard-container {
    display: flex;
    height: 100vh;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* ========== Sidebar ========== */
.sidebar {
    position: relative;
    width: 250px;
    height: 100%;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 4px 0 24px rgba(0, 119, 182, 0.2), inset -1px 0 0 rgba(255,255,255,0.3);
    overflow: hidden;
    z-index: 100;
}

.sidebar-nav {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(160deg, rgba(0,180,216,0.55) 0%, rgba(0,119,182,0.65) 100%),
        url('videoframe_4711 (1).png') center center / cover no-repeat;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 30px 20px;
    color: white;
    overflow-y: auto;
    z-index: 2;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-right: 1px solid rgba(255,255,255,0.25);
}

.sidebar.profile-open .sidebar-nav {
    transform: translateX(100%);
}

.sidebar-profile-panel {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    overflow-y: auto;
    z-index: 1;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.sidebar.profile-open .sidebar-profile-panel {
    transform: translateX(0);
}

.btn-close-profile {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.btn-close-profile:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.profile-panel-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.profile-avatar-section {
    text-align: center;
    padding: 20px 0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.profile-avatar-large {
    font-size: 64px;
    margin-bottom: 12px;
    display: block;
}

.profile-avatar-section h3 {
    font-size: 20px;
    margin-bottom: 4px;
}

.profile-avatar-section p {
    font-size: 13px;
    opacity: 0.8;
}

.profile-panel-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 8px;
}

.stat-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 600;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
}

.profile-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-profile-action {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: left;
}

.btn-profile-action:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-profile-action.btn-danger {
    background: rgba(239, 71, 111, 0.3);
    border-color: rgba(239, 71, 111, 0.5);
}

.btn-profile-action.btn-danger:hover {
    background: rgba(239, 71, 111, 0.5);
}

.btn-toggle-profile {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    z-index: 3;
}

.btn-toggle-profile:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.profile-icon {
    display: block;
}

.sidebar .logo h2 {
    font-size: 24px;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 600;
}

.nav-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-menu li {
    margin-bottom: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    color: white;
    text-decoration: none;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.2px;
    position: relative;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Liquid glass base */
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05),
        0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Liquid shimmer layer */
.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.12) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Ripple glow on hover */
.nav-link::after {
    content: '';
    position: absolute;
    left: -60%;
    top: -60%;
    width: 60%;
    height: 200%;
    background: linear-gradient(
        105deg,
        transparent 20%,
        rgba(255, 255, 255, 0.35) 50%,
        transparent 80%
    );
    transform: skewX(-20deg);
    transition: left 0.5s ease;
    pointer-events: none;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateX(5px) scale(1.02);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05),
        0 6px 20px rgba(0, 0, 0, 0.15),
        0 0 12px rgba(255, 255, 255, 0.1);
}

.nav-link:hover::before {
    opacity: 1;
}

.nav-link:hover::after {
    left: 120%;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-left: 3px solid rgba(255, 255, 255, 0.9);
    padding-left: 15px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05),
        0 4px 16px rgba(0, 0, 0, 0.12),
        0 0 20px rgba(255, 255, 255, 0.15);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.nav-link.active::before {
    opacity: 1;
}

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    position: relative;
    z-index: 50;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                filter 0.4s ease;
    background: transparent;
}

.dashboard-container.profile-mode .main-content {
    transform: translateX(30px);
    filter: brightness(0.95);
}

/* ========== Header ========== */
.header {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 25px 30px;
    box-shadow: 0 4px 16px rgba(0, 119, 182, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 500;
}

.header-title h1 {
    font-size: 28px;
    margin-bottom: 5px;
    color: #03045e;
    text-shadow: 0 1px 4px rgba(255,255,255,0.4);
}

.header-title p {
    color: #0077b6;
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn-profile-toggle-mobile {
    display: none;
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-profile-toggle-mobile:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
}

.btn-theme, .btn-logout {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-theme {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(8px);
    color: #03045e;
    border: 1px solid rgba(255,255,255,0.6);
}

.btn-theme:hover {
    background: rgba(255, 255, 255, 0.65);
    transform: translateY(-1px);
}

.btn-logout {
    background: linear-gradient(135deg, #ef476f, #d63460);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 71, 111, 0.3);
}

.btn-logout:hover {
    background: linear-gradient(135deg, #d63460, #b02050);
    transform: translateY(-1px);
}

/* ========== Profile Dropdown in Header ========== */
.profile-dropdown-container {
    position: relative;
    z-index: 9999;
}

.btn-profile-header {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-profile-header:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.profile-arrow {
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.profile-dropdown-container.open .profile-arrow {
    transform: rotate(180deg);
}

.profile-avatar-header {
    font-size: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: white;
    flex-shrink: 0;
    font-weight: 600;
}

.profile-name-header {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.profile-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 119, 182, 0.25), inset 0 1px 0 rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.6);
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999;
}

.profile-dropdown-container.open .profile-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-avatar {
    font-size: 24px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    color: white;
    flex-shrink: 0;
    font-weight: 600;
}

.dropdown-info h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #03045e;
}

.dropdown-info p {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: #0077b6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #03045e;
    transition: all 0.2s ease;
    font-weight: 500;
}

.dropdown-item:hover {
    background: rgba(0,180,216,0.1);
    transform: translateX(4px);
}

.dropdown-item.logout-item {
    color: var(--danger-color);
}

.dropdown-item.logout-item:hover {
    background-color: rgba(239, 71, 111, 0.1);
}

/* ========== Page Content ========== */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    min-height: 0;
    background: transparent;
}

.page {
    display: none;
    height: 100%;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

#chat-page {
    padding: 0;
    overflow: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========== Cards ========== */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(0, 119, 182, 0.15), inset 0 1px 0 rgba(255,255,255,0.6);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 32px rgba(0, 119, 182, 0.25), inset 0 1px 0 rgba(255,255,255,0.7);
    transform: translateY(-3px);
}

.card h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.card h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-dark);
}

/* ========== Statistics Cards ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* ── Liquid Glass Stat Cards ── */
.card-stat {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    border-left: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow:
        0 8px 32px rgba(0, 100, 180, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    color: white;
}

/* Tinted color layer per card */
.card-stat::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,180,216,0.45) 0%, rgba(0,100,180,0.55) 100%);
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

/* ── Card 1: Total Users — Dark navy futuristic glass ── */
.card-stat:nth-child(1) {
    background: rgba(5, 15, 40, 0.55);
    border: 1.5px solid rgba(60, 160, 255, 0.5);
    border-top: 1.5px solid rgba(100, 200, 255, 0.7);
    border-left: 1.5px solid rgba(80, 180, 255, 0.6);
    box-shadow:
        0 0 0 1px rgba(30, 100, 200, 0.3),
        0 8px 32px rgba(0, 80, 200, 0.4),
        inset 0 1px 0 rgba(100, 200, 255, 0.3),
        inset 0 0 40px rgba(0, 60, 160, 0.3);
}

.card-stat:nth-child(1)::before {
    background: linear-gradient(
        135deg,
        rgba(0, 20, 80, 0.7) 0%,
        rgba(0, 40, 120, 0.6) 40%,
        rgba(0, 80, 180, 0.4) 100%
    );
}

/* Bright blue rim light on card 1 */
.card-stat:nth-child(1)::after {
    background: linear-gradient(
        105deg,
        transparent 20%,
        rgba(80, 180, 255, 0.3) 50%,
        transparent 80%
    );
}

.card-stat:nth-child(1):hover {
    border-color: rgba(80, 180, 255, 0.8);
    box-shadow:
        0 0 0 1px rgba(60, 140, 255, 0.5),
        0 16px 40px rgba(0, 80, 220, 0.5),
        inset 0 1px 0 rgba(120, 220, 255, 0.4),
        inset 0 0 60px rgba(0, 60, 180, 0.35),
        0 0 20px rgba(40, 140, 255, 0.3);
}

.card-stat:nth-child(2)::before {
    background: linear-gradient(135deg, rgba(255,110,180,0.45) 0%, rgba(180,40,120,0.55) 100%);
}

.card-stat:nth-child(3)::before {
    background: linear-gradient(135deg, rgba(6,214,160,0.45) 0%, rgba(0,140,100,0.55) 100%);
}

.card-stat:nth-child(4)::before {
    background: linear-gradient(135deg, rgba(255,214,10,0.5) 0%, rgba(200,150,0,0.6) 100%);
}

/* Shimmer sweep */
.card-stat::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(
        105deg,
        transparent 20%,
        rgba(255, 255, 255, 0.18) 50%,
        transparent 80%
    );
    transform: skewX(-15deg);
    transition: left 0.6s ease;
    pointer-events: none;
    z-index: 1;
}

.card-stat:hover::after {
    left: 130%;
}

/* Keep content above pseudo-elements */
.card-stat .card-header,
.card-stat .card-body {
    position: relative;
    z-index: 2;
}

.card-stat:nth-child(4) .card-header h3,
.card-stat:nth-child(4) .stat-number,
.card-stat:nth-child(4) .stat-change {
    color: white;
}

.card-stat:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow:
        0 16px 40px rgba(0, 100, 180, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    border-color: rgba(255, 255, 255, 0.55);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    color: white;
    margin: 0;
}

.icon {
    font-size: 32px;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-change {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

/* ========== Charts Section ========== */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card-chart {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 300px;
}

.pie-chart {
    max-width: 300px;
    justify-self: center;
}

/* ========== Activity Section ========== */
.card-activity {
    margin-bottom: 30px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 24px;
    min-width: 30px;
}

.activity-details p {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.activity-details small {
    color: var(--text-light);
    font-size: 12px;
}

/* ========== Tables ========== */
.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.users-table thead {
    background-color: var(--light-bg);
    border-bottom: 2px solid var(--border-color);
}

.users-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
}

.users-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.users-table tbody tr:hover {
    background-color: var(--light-bg);
    transition: all 0.2s ease;
}

.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status.active {
    background-color: rgba(6, 214, 160, 0.2);
    color: var(--success-color);
}

.status.inactive {
    background-color: rgba(239, 71, 111, 0.2);
    color: var(--danger-color);
}

/* ========== Forms ========== */
.settings-form {
    max-width: 500px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-color: var(--card-bg);
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.2);
}

.form-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
}

.form-group label input[type="checkbox"] {
    display: flex;
    align-items: center;
    margin-bottom: 0;
}

/* ========== Buttons ========== */
.btn-primary {
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0096c7, #023e8a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 119, 182, 0.4);
}

.btn-small {
    padding: 6px 12px;
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: linear-gradient(135deg, #0096c7, #023e8a);
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ========== Responsive Design ========== */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
        padding: 20px 15px;
    }

    .header {
        flex-wrap: wrap;
        gap: 15px;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    .sidebar-nav {
        padding: 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .btn-toggle-profile {
        position: static;
        width: auto;
        height: auto;
        background: none;
        border: none;
    }

    .btn-profile-toggle-mobile {
        display: block;
    }

    .sidebar .logo h2 {
        margin-bottom: 0;
    }

    .nav-menu {
        display: none;
    }

    .nav-menu ul {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    .nav-menu.active {
        display: block;
    }

    .header {
        padding: 15px;
    }

    .header-title h1 {
        font-size: 20px;
    }

    .page-content {
        padding: 15px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }

    .stat-number {
        font-size: 24px;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .users-table {
        font-size: 12px;
    }

    .users-table th,
    .users-table td {
        padding: 8px;
    }

    /* Disable slide effect on mobile, use filter only */
    .dashboard-container.profile-mode .main-content {
        transform: none;
        filter: brightness(0.9);
    }
}

/* ========== Chat Styles (WhatsApp Web Style) ========== */

.chat-wrapper {
    display: flex;
    height: 100%;
    gap: 0;
    background-color: #fff;
}

/* ========== SIDEBAR (30%) ========== */

.chat-sidebar {
    width: 30%;
    background-color: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Profile Section */
.profile-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    background-color: #f8f9fa;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
    color: #111;
}

.profile-status {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: #65676b;
}

.btn-menu {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    transition: all 0.2s ease;
}

.btn-menu:hover {
    background-color: #e5e5ea;
    border-radius: 50%;
}

/* Search Bar */
.contacts-search {
    display: block;
    width: calc(100% - 24px);
    margin: 12px 12px 0;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 13px;
    background-color: #f0f0f0;
    color: #111;
    outline: none;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.contacts-search:focus {
    background-color: #e8e8ff;
    border-color: #667eea;
}

/* Contacts List */
.contacts-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.empty-contacts {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 13px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px;
    margin: 0 8px;
    background-color: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.contact-item:hover {
    background-color: #f2f2f2;
}

.contact-item.active {
    background-color: #e7f3ff;
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.contact-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-name {
    font-weight: 500;
    font-size: 14px;
    color: #111;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-message {
    font-size: 13px;
    color: #65676b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== CHAT AREA (70%) ========== */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-radius: 0;
    min-height: 0;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    padding: 12px 20px;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

.chat-status {
    font-size: 13px;
    color: #65676b;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.online-badge {
    font-size: 12px;
    color: #31a24c;
    font-weight: 500;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 20px;
    background: linear-gradient(180deg, #fff 0%, #f5f5f5 100%);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #999;
    font-size: 15px;
    gap: 8px;
}

.chat-message {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    animation: messageSlideIn 0.3s ease;
    align-items: flex-end;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.own {
    justify-content: flex-end;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    flex-shrink: 0;
}

.message-content {
    max-width: 60%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chat-message.own .message-content {
    align-items: flex-end;
}

.message-bubble {
    background-color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 18px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    animation: messageBounce 0.3s ease;
}

@keyframes messageBounce {
    0% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.chat-message.own .message-bubble {
    background: #dcf8c6;
    color: #000;
    border: none;
}

.message-header {
    display: none;
}

.message-name {
    font-weight: 600;
    color: var(--text-dark);
    display: none;
}

.message-time {
    color: var(--text-light);
    font-size: 11px;
    display: none;
}

.message-text {
    line-height: 1.4;
    color: #111;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.chat-message.own .message-text {
    color: #000;
}

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    background-color: #fff;
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    width: 100%;
    box-sizing: border-box;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex: 1;
    width: 100%;
}

.chat-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex: 1;
    min-width: 0;
}

#chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 20px;
    font-size: 14px;
    background-color: #f0f0f0;
    color: #111;
    outline: none;
    transition: all 0.2s ease;
    min-height: 40px;
    max-height: 120px;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    overflow-y: auto;
}

#chat-input:focus {
    border-color: #667eea;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#chat-input::placeholder {
    color: #999;
}

.btn-attachment,
.btn-emoji,
.btn-send {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    padding-bottom: 10px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-attachment:hover,
.btn-emoji:hover,
.btn-send:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.btn-send {
    color: #667eea;
    font-size: 20px;
    font-weight: 600;
    padding: 8px 12px;
}

.chat-sidebar {
    width: 30%;
    background-color: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-width: 0;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    background-color: #f8f9fa;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
    color: #111;
}

.profile-status {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: #65676b;
}

.btn-menu {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    transition: all 0.2s ease;
}

.btn-menu:hover {
    background-color: #e5e5ea;
    border-radius: 50%;
}

.contacts-search {
    display: block;
    width: calc(100% - 24px);
    margin: 12px 12px 0;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 13px;
    background-color: #f0f0f0;
    color: #111;
    outline: none;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.contacts-search:focus {
    background-color: #e8e8ff;
    border-color: #667eea;
}

.contacts-header {
    display: none;
}

.contacts-count {
    display: none;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.empty-contacts {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 13px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px;
    margin: 0 8px;
    background-color: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.contact-item:hover {
    background-color: #f2f2f2;
}

.contact-item.active {
    background-color: #e7f3ff;
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.contact-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-name {
    font-weight: 500;
    font-size: 14px;
    color: #111;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-message {
    font-size: 13px;
    color: #65676b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== Scrollbar Styles ========== */
.chat-messages::-webkit-scrollbar,
.chat-sidebar::-webkit-scrollbar,
.contacts-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-sidebar::-webkit-scrollbar-track,
.contacts-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-sidebar::-webkit-scrollbar-thumb,
.contacts-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-sidebar::-webkit-scrollbar-thumb:hover,
.contacts-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

@media (max-width: 480px) {
    .sidebar {
        padding: 10px;
    }

    .header {
        padding: 12px;
        flex-direction: column;
        gap: 10px;
    }

    .header-title h1 {
        font-size: 18px;
    }

    .header-actions {
        width: 100%;
        gap: 8px;
    }

    .btn-theme, .btn-logout {
        flex: 1;
        padding: 8px 12px;
        font-size: 12px;
    }

    .page-content {
        padding: 10px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .card {
        padding: 16px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .icon {
        align-self: flex-end;
        margin-top: -20px;
    }

    .auth-card {
        margin: 20px;
        padding: 30px 20px;
        max-width: 100%;
    }

    .auth-logo h1 {
        font-size: 24px;
    }

    .auth-card h2 {
        font-size: 20px;
    }

    /* Chat Responsive */
    .chat-wrapper {
        flex-direction: column;
    }

    .chat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 180px;
    }

    .chat-container {
        flex: 1;
    }

    .chat-messages {
        max-height: 400px;
    }

    .message-content {
        max-width: 85%;
    }

    .chat-form {
        gap: 8px;
    }

    #chat-input {
        padding: 10px 12px;
        font-size: 13px;
        height: 40px;
        line-height: 40px;
    }

    .btn-send {
        padding: 10px 16px;
        font-size: 13px;
        height: 40px;
        line-height: 40px;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .chat-header h2 {
        font-size: 16px;
    }

    .chat-selected-user {
        display: none !important;
    }

    .contacts-header h3 {
        font-size: 16px;
    }

    .contact-item {
        padding: 10px;
    }

    .contact-avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .contact-name {
        font-size: 13px;
    }

    .contact-email {
        font-size: 11px;
    }

    .chat-sidebar {
        padding: 12px;
    }

    .contacts-search {
        font-size: 12px;
        padding: 8px;
    }
}

/* ========== Ocean Animated Bubbles ========== */
.ocean-bubbles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -80px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.7), rgba(255,255,255,0.1));
    border: 1px solid rgba(255,255,255,0.5);
    animation: bubbleRise linear infinite;
    box-shadow: inset 0 0 8px rgba(255,255,255,0.3);
}

.bubble:nth-child(1)  { width: 18px; height: 18px; left: 8%;   animation-duration: 9s;  animation-delay: 0s;   }
.bubble:nth-child(2)  { width: 28px; height: 28px; left: 18%;  animation-duration: 12s; animation-delay: 1.5s; }
.bubble:nth-child(3)  { width: 12px; height: 12px; left: 30%;  animation-duration: 8s;  animation-delay: 3s;   }
.bubble:nth-child(4)  { width: 36px; height: 36px; left: 42%;  animation-duration: 14s; animation-delay: 0.5s; }
.bubble:nth-child(5)  { width: 20px; height: 20px; left: 55%;  animation-duration: 10s; animation-delay: 2s;   }
.bubble:nth-child(6)  { width: 14px; height: 14px; left: 65%;  animation-duration: 7s;  animation-delay: 4s;   }
.bubble:nth-child(7)  { width: 30px; height: 30px; left: 75%;  animation-duration: 13s; animation-delay: 1s;   }
.bubble:nth-child(8)  { width: 10px; height: 10px; left: 85%;  animation-duration: 6s;  animation-delay: 2.5s; }
.bubble:nth-child(9)  { width: 22px; height: 22px; left: 92%;  animation-duration: 11s; animation-delay: 0.8s; }
.bubble:nth-child(10) { width: 16px; height: 16px; left: 50%;  animation-duration: 9s;  animation-delay: 3.5s; }

@keyframes bubbleRise {
    0%   { transform: translateY(0) translateX(0) scale(1);    opacity: 0; }
    10%  { opacity: 0.8; }
    50%  { transform: translateY(-45vh) translateX(15px) scale(1.05); opacity: 0.6; }
    90%  { opacity: 0.3; }
    100% { transform: translateY(-105vh) translateX(-10px) scale(0.9); opacity: 0; }
}

/* ========== Sidebar Profile Panel Ocean Theme ========== */
.sidebar-profile-panel {
    background: linear-gradient(160deg, rgba(0,150,199,0.85) 0%, rgba(2,62,138,0.9) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* ========== Chat Glass Theme ========== */
.chat-wrapper {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.chat-sidebar {
    background: rgba(255,255,255,0.35) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.chat-container {
    background: rgba(255,255,255,0.25) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.chat-header {
    background: rgba(255,255,255,0.4) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.5) !important;
}

.chat-messages {
    background: linear-gradient(180deg, rgba(202,240,248,0.3) 0%, rgba(144,224,239,0.2) 100%) !important;
}

.chat-input-area {
    background: rgba(255,255,255,0.4) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.5) !important;
}

#chat-input {
    background: rgba(255,255,255,0.5) !important;
    border: 1px solid rgba(0,180,216,0.3) !important;
    color: #03045e !important;
}

#chat-input:focus {
    background: rgba(255,255,255,0.75) !important;
    border-color: #00b4d8 !important;
}

.profile-section {
    background: rgba(255,255,255,0.3) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.contacts-search {
    background: rgba(255,255,255,0.4) !important;
    border: 1px solid rgba(0,180,216,0.3) !important;
    color: #03045e !important;
}

/* ========== Users Table Glass ========== */
.users-table thead {
    background: rgba(0,180,216,0.15) !important;
}

.users-table tbody tr:hover {
    background: rgba(255,255,255,0.4) !important;
}

/* ========== Settings Form Glass ========== */
.form-group input,
.form-group select {
    background: rgba(255,255,255,0.5) !important;
    border: 1px solid rgba(0,180,216,0.3) !important;
    color: #03045e !important;
    border-radius: 10px;
}

.form-group input:focus,
.form-group select:focus {
    background: rgba(255,255,255,0.75) !important;
    border-color: #00b4d8 !important;
    box-shadow: 0 0 0 3px rgba(0,180,216,0.2) !important;
}

/* ========== Loading Screen ========== */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--ocean-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-logo {
    font-size: 28px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.loading-bubbles {
    display: flex;
    gap: 10px;
}

.loading-bubbles span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    animation: loadingBounce 1.2s ease-in-out infinite;
}

.loading-bubbles span:nth-child(2) { animation-delay: 0.2s; }
.loading-bubbles span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40%            { transform: scale(1.2); opacity: 1; }
}

/* ========== Message Timestamp ========== */
.message-time-label {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
    padding: 0 4px;
    display: block;
}

.chat-message.own .message-time-label {
    text-align: right;
    color: #6a9;
}

/* ========== Profile Modal (Unified) ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0, 60, 120, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-box {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 24px;
    padding: 36px 32px 28px;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 100, 180, 0.25);
    position: relative;
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 119, 182, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    color: #03045e;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.modal-close:hover {
    background: rgba(239, 71, 111, 0.15);
    color: #ef476f;
    transform: scale(1.1);
}

/* ── Photo wrapper ── */
.modal-profile-header {
    text-align: center;
    margin-bottom: 20px;
}

.profile-photo-wrapper {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 12px;
    cursor: pointer;
}

.profile-photo-wrapper:hover .photo-upload-overlay {
    opacity: 1;
}

#profile-photo-img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.8);
    box-shadow: 0 4px 16px rgba(0,119,182,0.3);
    display: block;
}

.modal-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    color: white;
    font-size: 36px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 119, 182, 0.3);
    border: 3px solid rgba(255,255,255,0.8);
}

.photo-upload-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
    border: none;
    padding: 0;
    letter-spacing: 0.2px;
}

.profile-photo-wrapper:hover .photo-upload-overlay {
    opacity: 1;
}

.photo-upload-progress {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.modal-profile-header h2 {
    font-size: 20px;
    color: #03045e;
    margin: 0 0 6px;
}

.view-role-badge {
    display: inline-block;
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
}

/* ── View mode ── */
.modal-profile-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 14px;
    background: rgba(0, 180, 216, 0.07);
    border-radius: 10px;
    border: 1px solid rgba(0, 180, 216, 0.15);
    gap: 12px;
}

.info-label {
    font-size: 13px;
    font-weight: 600;
    color: #0077b6;
    white-space: nowrap;
    min-width: 100px;
}

.info-value {
    font-size: 13px;
    color: #03045e;
    text-align: right;
    word-break: break-word;
}

/* ── Edit mode ── */
#edit-profile-form .form-group label {
    color: #03045e;
    font-size: 13px;
}

#edit-profile-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(0, 180, 216, 0.3);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.5);
    color: #03045e;
    resize: vertical;
    font-family: inherit;
    transition: all 0.3s ease;
}

#edit-profile-form textarea:focus {
    outline: none;
    border-color: #00b4d8;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

#edit-profile-msg {
    font-size: 13px;
    text-align: center;
    min-height: 18px;
    font-weight: 600;
}

.btn-secondary-outline {
    padding: 12px 20px;
    border: 1.5px solid rgba(0,180,216,0.5);
    border-radius: 12px;
    background: transparent;
    color: #0077b6;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary-outline:hover {
    background: rgba(0,180,216,0.1);
}

/* ========== Pineapple Logo Icon ========== */
.logo-icon {
    width: 40px;
    height: 48px;
    vertical-align: middle;
    display: inline-block;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}

.loading-logo .logo-icon {
    width: 48px;
    height: 58px;
}

.auth-logo h1 .logo-icon {
    width: 44px;
    height: 52px;
}

.sidebar .logo h2 .logo-icon {
    width: 38px;
    height: 46px;
}

/* ========== Finance Page ========== */
.finance-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.finance-summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-radius: 20px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.5);
    color: white;
    position: relative;
    overflow: hidden;
}

.finance-summary-card.income  { background: rgba(6,214,160,0.25); border-color: rgba(6,214,160,0.5); }
.finance-summary-card.expense { background: rgba(239,71,111,0.25); border-color: rgba(239,71,111,0.5); }
.finance-summary-card.balance { background: rgba(0,180,216,0.25);  border-color: rgba(0,180,216,0.5); }

.fs-icon { font-size: 32px; }
.fs-label { font-size: 12px; opacity: 0.85; margin-bottom: 4px; }
.fs-amount { font-size: 22px; font-weight: 700; }

.finance-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    align-items: start;
}

.finance-form-card h3,
.finance-history-card h3 { color: #03045e; margin-bottom: 16px; }

/* Type toggle */
.type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.type-btn {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    border: 1.5px solid rgba(0,180,216,0.3);
    background: rgba(255,255,255,0.4);
    color: #0077b6;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.type-btn.active[data-type="income"] {
    background: rgba(6,214,160,0.25);
    border-color: #06d6a0;
    color: #03045e;
    box-shadow: 0 0 0 2px rgba(6,214,160,0.3);
}

.type-btn.active[data-type="expense"] {
    background: rgba(239,71,111,0.2);
    border-color: #ef476f;
    color: #03045e;
    box-shadow: 0 0 0 2px rgba(239,71,111,0.3);
}

.type-btn:hover { transform: translateY(-1px); }

#finance-msg {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    min-height: 18px;
    margin-bottom: 4px;
}

/* History */
.finance-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.finance-filter select {
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0,180,216,0.3);
    background: rgba(255,255,255,0.5);
    color: #03045e;
    font-size: 13px;
    cursor: pointer;
}

.finance-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 520px;
    overflow-y: auto;
}

.finance-empty {
    text-align: center;
    color: #0077b6;
    padding: 40px 0;
    font-size: 14px;
    opacity: 0.7;
}

.finance-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.35);
    border: 1px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    position: relative;
}

.finance-item:hover { transform: translateX(4px); background: rgba(255,255,255,0.5); }

.finance-item-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.finance-item.income .finance-item-icon { background: rgba(6,214,160,0.2); }
.finance-item.expense .finance-item-icon { background: rgba(239,71,111,0.2); }

.finance-item-info { flex: 1; min-width: 0; }
.finance-item-desc {
    font-weight: 600;
    font-size: 14px;
    color: #03045e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.finance-item-meta { font-size: 12px; color: #0077b6; margin-top: 2px; }

.finance-item-amount {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}
.finance-item.income  .finance-item-amount { color: #06d6a0; }
.finance-item.expense .finance-item-amount { color: #ef476f; }

.finance-item-delete {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 4px;
    color: #ef476f;
}
.finance-item:hover .finance-item-delete { opacity: 1; }

@media (max-width: 900px) {
    .finance-layout { grid-template-columns: 1fr; }
    .finance-summary { grid-template-columns: 1fr; }
}

/* ── Card Total Saldo (Emerald Green) ── */
.card-stat-saldo {
    background: rgba(5, 40, 20, 0.55) !important;
    border: 1.5px solid rgba(6, 214, 160, 0.5) !important;
    border-top: 1.5px solid rgba(80, 255, 180, 0.7) !important;
    border-left: 1.5px solid rgba(60, 220, 150, 0.6) !important;
    box-shadow:
        0 0 0 1px rgba(6, 180, 100, 0.3),
        0 8px 32px rgba(0, 120, 60, 0.4),
        inset 0 1px 0 rgba(80, 255, 180, 0.3),
        inset 0 0 40px rgba(0, 100, 50, 0.3) !important;
}

.card-stat-saldo::before {
    background: linear-gradient(
        135deg,
        rgba(0, 60, 30, 0.7) 0%,
        rgba(0, 100, 50, 0.6) 40%,
        rgba(6, 180, 100, 0.4) 100%
    ) !important;
}

.card-stat-saldo::after {
    background: linear-gradient(
        105deg,
        transparent 20%,
        rgba(80, 255, 180, 0.25) 50%,
        transparent 80%
    ) !important;
}

.card-stat-saldo:hover {
    border-color: rgba(80, 255, 180, 0.8) !important;
    box-shadow:
        0 0 0 1px rgba(60, 200, 120, 0.5),
        0 16px 40px rgba(0, 120, 60, 0.5),
        inset 0 1px 0 rgba(120, 255, 200, 0.4),
        inset 0 0 60px rgba(0, 100, 50, 0.35),
        0 0 20px rgba(40, 200, 120, 0.3) !important;
}

.card-stat-saldo.negative::before {
    background: linear-gradient(
        135deg,
        rgba(60, 0, 20, 0.7) 0%,
        rgba(120, 0, 40, 0.6) 40%,
        rgba(200, 30, 60, 0.4) 100%
    ) !important;
}
