/* --- Base Variables & Reset --- */
:root {
    --primary-color: #2563EB; /* Clean Enterprise Blue */
    --primary-hover: #1D4ED8;
    --bg-color: #F8FAFC;
    --surface-color: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --sidebar-width: 260px;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    -webkit-user-select: none; /* Gives it a native app feel */
    user-select: none;
}

.user-profile {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 8px 16px;
    background-color: #F1F5F9;
    border-radius: 20px;
}
.user-profile:hover{
    background-color:white;
}

/* --- Dashboard Container --- */
.dashboard-container {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.welcome-banner {
    margin-bottom: 24px;
}

.welcome-banner h2 {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.welcome-banner p {
    color: var(--text-muted);
}

.placeholder-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.card {
    background: var(--surface-color);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .placeholder-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Fees View Styles --- */
.fees-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.stat-card {
    background: var(--surface-color);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.stat-card.alert .stat-amount {
    color: #DC2626; /* Red for pending */
}

.stat-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.search-input {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 300px;
    max-width: 100%;
    outline: none;
    font-size: 0.95rem;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.w-100 { width: 100%; }

/* Table Styles */
.table-container {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: #F8FAFC;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: #F1F5F9;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-paid {
    background-color: #DCFCE7;
    color: #166534;
}

.badge-pending {
    background-color: #FEF2F2;
    color: #991B1B;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface-color);
    padding: 24px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input, .form-group select {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
}

/* --- Kanban Board (Leads View) --- */
.kanban-board {
    display: flex;
    gap: 24px;
    padding: 32px;
    overflow-x: auto;
    height: calc(100vh - 80px); /* Fill remaining height */
    align-items: flex-start;
}

.kanban-column {
    background-color: #F1F5F9;
    border-radius: 12px;
    min-width: 300px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.kanban-header {
    padding: 16px;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

.lead-count {
    background: #E2E8F0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.kanban-cards {
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lead-card {
    background: var(--surface-color);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    cursor: grab;
}

.lead-card h4 {
    margin-bottom: 4px;
    font-size: 1rem;
}

.lead-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
    align-items: center;
    flex-wrap: wrap; 
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: 6px;
    cursor: pointer;
    flex: 1;
}

.btn-small.whatsapp {
    background-color: #25D366; /* WhatsApp Green */
    color: white;
    border: none;
}

.card-actions button {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    padding: 6px 8px;
    font-size: 13px;
}

.card-actions button:last-child {
    flex-basis: 100%; 
    margin-top: 2px;
}

/* --- WhatsApp View --- */
.whatsapp-view {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 32px;
    padding: 32px;
    max-width: 1200px;
}

.builder-card, .rules-list-card {
    background: var(--surface-color);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    height: fit-content;
}

.builder-card h2, .rules-list-card h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

textarea {
    resize: vertical;
    font-family: inherit;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
}

textarea:focus {
    border-color: var(--primary-color);
}

.rules-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.rule-item {
   padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #F8FAFC;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px; 
}

.rule-content {
    flex: 1; 
    min-width: 0; 
}

.trigger-badge {
   background-color: #25D366; /* WhatsApp Green */
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 8px;
}

.reply-preview {
   font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
    word-break: break-word;
    white-space: normal;
}

.delete-btn {
    color: #DC2626;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    flex-shrink: 0; 
}

@media (max-width: 900px) {
    .whatsapp-view {
        grid-template-columns: 1fr; 
    }
}

/* --- Dashboard Specific Styles --- */
.activity-section {
    margin-top: 40px;
}

.activity-section h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-main);
}

.quick-actions-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.action-btn {
    background-color: #F8FAFC;
    border: 1px solid var(--border-color);
    padding: 16px 24px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.2s;
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.action-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* --- Login Page Specific Styles --- */
.login-body {
    background-color: #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
}

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

.login-card {
    background: var(--surface-color);
    padding: 40px 32px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
}

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

.login-header h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.error-text {
    color: #DC2626; 
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: center;
    min-height: 20px; 
    font-weight: 500;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}
.shake { animation: shake 0.4s ease-in-out; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* --- Toast Notifications --- */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #10B981; 
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-weight: 500;
    z-index: 9999;
    transform: translateX(150%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); 
}

.toast-notification.show {
    transform: translateX(0); 
}

/* --- Settings View Styles --- */
.settings-view {
    padding: 32px;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.settings-card {
    background: var(--surface-color);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.text-muted {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Custom Toggle Switch */
.toggle-group {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #CBD5E1;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* --- Dark Mode Variables --- */
body.dark-mode {
    --bg-color: #0F172A;
    --surface-color: #1E293B;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --border-color: #334155;
}

/* --- Fix the sharp click/focus rectangle --- */
button:focus, 
.action-btn:focus,
.btn-primary:focus {
    outline: none; 
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4); 
}

button, .action-btn, .btn-primary {
    overflow: hidden; 
}

/* --- Pricing Page Styles --- */
.pricing-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    width: 100%;
}

.pricing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    max-width: 900px;
    width: 100%;
}

.pricing-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

.pricing-card.premium {
    border: 2px solid var(--primary-color);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.1);
}

.premium-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.plan-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.plan-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
    min-height: 44px;
}

.plan-price {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 32px;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.price-currency {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.price-period {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.feature-list {
    list-style: none;
    margin-bottom: 40px;
    flex-grow: 1;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--text-main);
    font-size: 0.95rem;
}

.check-icon {
    color: #10B981; 
    font-weight: bold;
    flex-shrink: 0;
}

.plan-btn {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--text-muted);
    background: #F8FAFC;
}

@media (max-width: 768px) {
    .pricing-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Bot Simulator Styles --- */
.test-bot-card {
    background: var(--surface-color);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.chat-window {
    height: 300px;
    overflow-y: auto;
    background-color: #E5DDD5; 
    background-image: url('https://www.transparenttextures.com/patterns/cubes.png');
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.msg-sent {
    background-color: #DCF8C6; 
    align-self: flex-end;
    border-top-right-radius: 0;
}

.msg-received {
    background-color: #FFFFFF;
    align-self: flex-start;
    border-top-left-radius: 0;
}

.chat-input-area {
    display: flex;
    gap: 8px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 24px; 
    outline: none;
}

.chat-input-area input:focus {
    border-color: var(--primary-color);
}

/* ========================================================= */
/*                   PARENT CHAT PORTAL                      */
/* ========================================================= */

.view-container { display: none; height: 100vh; width: 100%; flex-direction: column; background-color: #F3F4F6;}
.view-container.active { display: flex; }

#login-view { justify-content: center; align-items: center; padding: 20px; }
.login-box { background: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; max-width: 400px; text-align: center; }
.login-box h2 { color: #4F46E5; margin-bottom: 10px; }
.login-box p { color: #6B7280; font-size: 0.9rem; margin-bottom: 25px; }
.input-group { margin-bottom: 15px; text-align: left; }
.input-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: #1F2937; }
.input-group input { width: 100%; padding: 12px; border: 1px solid #D1D5DB; border-radius: 8px; font-size: 1rem; }
#login-btn { width: 100%; padding: 12px; background: #4F46E5; color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: bold; cursor: pointer; margin-top: 10px; }
.error-msg { color: #DC2626; font-size: 0.85rem; margin-top: 10px; }

.chat-header { background: white; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.05); z-index: 10; }
.header-info { display: flex; align-items: center; gap: 10px; }
.avatar { font-size: 1.5rem; background: #EEF2FF; padding: 8px; border-radius: 50%; }
.chat-header h3 { font-size: 1.1rem; color: #1F2937; }
.status { font-size: 0.75rem; color: #10B981; font-weight: 600; }
.logout-btn { background: transparent; color: #EF4444; border: none; font-weight: 600; cursor: pointer; }

.chat-window { flex: 1; background: #E5E7EB; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.message { display: flex; max-width: 85%; }
.message.bot { align-self: flex-start; }
.message.user { align-self: flex-end; }
.bubble { padding: 12px 16px; border-radius: 16px; font-size: 0.95rem; line-height: 1.4; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.bot .bubble { background: #FFFFFF; color: #1F2937; border-bottom-left-radius: 4px; }
.user .bubble { background: #4F46E5; color: white; border-bottom-right-radius: 4px; }

.chat-input-area { background: white; padding: 15px; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); }
#chat-form { display: flex; gap: 10px; margin: 0; }
#chat-input { flex: 1; padding: 12px 15px; border: 1px solid #D1D5DB; border-radius: 24px; font-size: 1rem; outline: none; }
#chat-input:focus { border-color: #4F46E5; }
#send-btn { background: #4F46E5; color: white; border: none; width: 45px; height: 45px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; }

/* ========================================================= */
/*              LOGIN PAGE: PARENT PORTAL CTA                */
/* ========================================================= */

.parent-access-card {
    margin-top: 24px;
    padding: 16px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.parent-access-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.parent-icon {
    font-size: 1.5rem;
    background: #EEF2FF;
    padding: 8px 12px;
    border-radius: 8px;
}

.parent-access-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
}

.parent-access-info p {
    margin: 2px 0 0 0;
    font-size: 0.8rem;
    color: #6B7280;
}

.btn-parent-chat {
    display: block;
    text-align: center;
    padding: 10px 16px;
    background: #4F46E5;
    color: #FFFFFF;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s ease-in-out;
}

.btn-parent-chat:hover {
    background: #4338CA;
}

/* ========================================================= */
/*                 NEW MOBILE APP LAYOUT                     */
/* ========================================================= */

/* Top Header Styles */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-left h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--primary-color);
}

.header-right {
  display: flex;
  gap: 16px;
}

.action-icon, .expand-icon {
  cursor: pointer;
  color: var(--text-muted);
}

/* Main Content Area */
.app-content {
  flex: 1;
  overflow-y: auto;
  margin-top: 60px; /* Space for top header */
  margin-bottom: 75px; /* Space for bottom nav */
  padding: 20px 16px;
  width: 100%;
}

/* Bottom Navigation Styles */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background-color: var(--surface-color);
  border-top: 1px solid var(--border-color);
  position: fixed;
  bottom: 0;
  width: 100%;
  padding: 10px 0;
  padding-bottom: env(safe-area-inset-bottom, 10px);
  z-index: 1000;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-muted);
  gap: 4px;
  transition: color 0.2s;
}

.nav-item span:last-child {
  font-size: 12px;
  font-weight: 500;
}

.nav-item.active {
  color: #25D366; /* WhatsApp green */
}
/* Overflow 3-Dots Menu */
.dropdown-menu {
    position: absolute;
    top: 40px;
    right: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 200px;
    display: none; /* Hidden by default */
    flex-direction: column;
    z-index: 2000;
    overflow: hidden;
}

.dropdown-menu.active {
    display: flex;
}

.dropdown-item {
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #F1F5F9;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

.text-danger {
    color: #DC2626;
}

.text-danger:hover {
    background-color: #FEF2F2;
}

/* Update dark mode hover for dropdown */
body.dark-mode .dropdown-item:hover {
    background-color: #334155;
}
body.dark-mode .text-danger:hover {
    background-color: rgba(220, 38, 38, 0.1);
}

/* --- Plan Selector Badge & Dropdown --- */
.plan-selector {
    display: flex;
    align-items: center;
    background: #EEF2FF; /* Light Primary Color */
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 2px;
    transition: background 0.2s;
    margin-left: 4px;
}

.plan-selector:hover {
    background: #E0E7FF;
}

.plan-selector .expand-icon {
    font-size: 18px;
    color: var(--primary-color);
}

/* --- Dropdown Overrides --- */
.plan-dropdown-menu {
    position: absolute !important;
    top: 45px !important;
    left: 0 !important;
    background-color: var(--surface-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
    min-width: 220px !important;
    display: none !important; /* Hidden securely by default */
    flex-direction: column !important;
    z-index: 9999 !important; /* Forces it to the very front */
}

/* When JS adds the 'active' class, this takes over */
.plan-dropdown-menu.active {
    display: flex !important;
}

.plan-dropdown-header {
    padding: 10px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.active-plan {
    background-color: #F8FAFC;
}

body.dark-mode .plan-selector {
    background: #1E293B;
}
body.dark-mode .plan-selector:hover {
    background: #334155;
}
body.dark-mode .active-plan {
    background-color: #0F172A;
}

/* WhatsApp-style message layout */
.chat-msg, .bubble {
    position: relative;
    padding-bottom: 20px !important; /* Space for the time at the bottom */
    padding-right: 60px !important;  /* Space on the right so long text doesn't overlap the time */
    min-width: 0 !important; /* Removes the awkwardly wide box for short messages */
}

.msg-meta {
    position: absolute;
    bottom: 4px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.65rem;
    color: rgba(0, 0, 0, 0.45); /* Default Gray text for all white bubbles */
}

/* Make time text white ONLY for colored bubbles (Admin Green & Parent Blue) */
.msg-sent .msg-meta, .message.user .msg-meta {
    color: rgba(255, 255, 255, 0.85); 
}

.tick-icon {
    font-size: 14px !important; 
}

.tick-read {
    color: #34B7F1 !important; 
}
/* ========================================================= */
/*       BLUEPRINT CHAT UI OVERRIDES (ADDED SAFELY)          */
/* ========================================================= */

/* Enforce Brand Blue */
:root {
    --primary-color: #2563EB; 
}

/* Active Nav Icon Color */
.nav-item.active { 
    color: var(--primary-color) !important; 
}

/* Admin Chat Message Bubble Overrides */
.chat-msg, .bubble { 
    position: relative; 
    padding-bottom: 20px !important; 
    padding-right: 60px !important; 
    min-width: 0 !important; 
}

.msg-sent { 
    background-color: #E0E7FF !important; /* Subtle Blue to match Brand */
    align-self: flex-end; 
    border-top-right-radius: 0; 
} 

.msg-received { 
    background-color: #FFFFFF !important; 
    align-self: flex-start; 
    border-top-left-radius: 0; 
}

/* Time & Tick Meta Positioning */
.msg-meta { 
    position: absolute; 
    bottom: 4px; 
    right: 8px; 
    display: flex; 
    align-items: center; 
    gap: 2px; 
    font-size: 0.65rem; 
    color: rgba(0, 0, 0, 0.45) !important; 
}

.tick-icon { 
    font-size: 14px !important; 
}

.tick-read { 
    color: #34B7F1 !important; 
}
/* Update global chat backgrounds to complement brand blue */
.chat-window {
    background-color: #F1F5F9 !important;
}