@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #0f172a;
    --primary-surface: rgba(30, 41, 59, 0.75);
    --glass-surface: rgba(51, 65, 85, 0.4);
    --border-color: rgba(148, 163, 184, 0.15);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-teal: #2dd4bf;
    --accent-blue: #38bdf8;
    --accent-purple: #a78bfa;
    --accent-red: #fb7185;
    --accent-green: #4ade80;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --navbar-height: 70px;
}

* { box-sizing: border-box; margin: 0; padding: 0; scrollbar-width: thin; scrollbar-color: var(--accent-teal) transparent; }

body { font-family: 'Poppins', sans-serif; background-color: var(--bg-main); color: var(--text-primary); line-height: 1.6; overflow-x: hidden; }

.background-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -2; background: var(--bg-main); }
.aurora-background { position: absolute; width: 200%; height: 200%; top: -50%; left: -50%; background: radial-gradient(ellipse at center, rgba(167, 139, 250, 0.1) 0%, rgba(45, 212, 191, 0.05) 40%, rgba(15, 23, 42, 0) 70%); animation: aurora-flow 30s linear infinite; }
@keyframes aurora-flow { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Universal Buttons */
.modern-btn {
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-blue));
    color: #0f172a; border: none; padding: 10px 16px; border-radius: 8px; font-weight: 600; cursor: pointer;
    transition: all 0.2s; box-shadow: 0 4px 12px rgba(45, 212, 191, 0.2); display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 0.95rem;
}
.modern-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(45, 212, 191, 0.3); }
.modern-btn:active { transform: scale(0.97); }

/* Auth */
#auth-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 1rem; animation: fadeIn 0.8s ease; }
.auth-card { width: 100%; max-width: 400px; background: var(--primary-surface); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding: 2.5rem; border-radius: 16px; border: 1px solid var(--border-color); text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.auth-card h2 { margin-bottom: 1.5rem; font-size: 1.8rem; font-weight: 700; background: linear-gradient(to right, var(--accent-teal), var(--accent-blue)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.auth-tabs { display: flex; background: rgba(0,0,0,0.2); border-radius: 8px; padding: 4px; margin-bottom: 2rem; }
.auth-tab-btn { flex: 1; padding: 10px; background: none; border: none; color: var(--text-secondary); cursor: pointer; border-radius: 6px; font-weight: 500; transition: 0.3s; }
.auth-tab-btn.active { background: var(--glass-surface); color: var(--text-primary); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.auth-card input { background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: white; padding: 14px; width: 100%; border-radius: 8px; margin-bottom: 1rem; outline: none; transition: 0.3s; }
.auth-card input:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2); }
#submit-auth-btn { width: 100%; margin-top: 1rem; padding: 14px; font-size: 1rem; }

/* Navbar */
.top-navbar { position: fixed; top: 0; width: 100%; height: var(--navbar-height); background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-color); z-index: 1000; display: flex; align-items: center; justify-content: space-between; padding: 0 5%; }
.navbar-brand { font-size: 1.4rem; font-weight: 700; color: white; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.navbar-brand svg { stroke: var(--accent-teal); }
.navbar-right { display: flex; gap: 1rem; align-items: center; }
.action-btn { background: rgba(255,255,255,0.05); color: var(--text-primary); border: 1px solid var(--border-color); padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; transition: 0.3s; display: flex; align-items: center; gap: 8px; text-decoration: none; }
.action-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--text-secondary); }
#logout-btn { background: rgba(244, 63, 94, 0.2); border-color: rgba(244, 63, 94, 0.4); color: #fb7185; }
#logout-btn:hover { background: rgba(244, 63, 94, 0.3); }

/* Mobile Menu */
.mobile-menu-btn { display: none; background: none; border: none; color: white; cursor: pointer; }
.mobile-nav-dropdown { display: none; position: absolute; top: 70px; right: 20px; width: 200px; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 12px; padding: 10px; flex-direction: column; gap: 10px; }
.mobile-nav-dropdown.visible { display: flex; animation: fadeIn 0.2s; }
.mobile-nav-dropdown .action-btn { width: 100%; justify-content: center; }

/* Dashboard */
#app-container { padding-top: var(--navbar-height); height: 100vh; display: none; }
.main-content { height: 100%; overflow-y: auto; padding: 2rem 5%; }
.content-view { display: none; animation: fadeInUp 0.4s ease; max-width: 1200px; margin: 0 auto; }
.content-view.active { display: block; }
.main-header h1 { font-size: 2rem; margin-bottom: 2rem; font-weight: 600; }


/* Child List */
#child-list-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.child-card { background: var(--glass-surface); border: 1px solid var(--border-color); border-radius: 16px; padding: 2rem; cursor: pointer; transition: 0.3s; display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.child-card:hover { transform: translateY(-5px); background: rgba(56, 189, 248, 0.1); border-color: var(--accent-blue); }
.child-card svg { width: 48px; height: 48px; stroke: var(--accent-blue); }
.child-card .user-name { font-size: 1.2rem; font-weight: 600; color: white; }
.child-card .device-name { color: var(--text-secondary); font-size: 0.9rem; }

/* Category Buttons */
.category-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1.2rem; }
.category-btn { background: var(--glass-surface); border: 1px solid var(--border-color); border-radius: 16px; padding: 1.5rem; min-height: 140px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; text-align: center; color: var(--text-primary); transition: 0.3s; }
.category-btn:hover { background: rgba(56, 189, 248, 0.15); border-color: var(--accent-blue); transform: translateY(-4px); }
.category-btn[data-category="coming-soon"] { opacity: 0.6; cursor: not-allowed; }

/* Data View */
.data-header { display: flex; justify-content: flex-end; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 10px; }
.data-grid, .status-grid, .media-grid { display: grid; gap: 1rem; }
.data-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Universal Data Card */
.data-card { background: var(--glass-surface); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.2rem; display: flex; flex-direction: column; gap: 8px; transition: 0.2s; }
.data-card:hover { border-color: var(--accent-teal); transform: translateY(-2px); }
.data-card-header { display: flex; align-items: center; gap: 10px; font-weight: 600; color: white; margin-bottom: 4px; }
.data-card-body { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.5; word-wrap: break-word; }
.data-card-footer { font-size: 0.8rem; color: var(--text-secondary); opacity: 0.7; text-align: right; margin-top: auto; }

/* Status Card */
.status-card { background: none; border: none; padding: 0; }
.status-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 1rem; }
.status-item { background: rgba(30, 41, 59, 0.6); padding: 1rem; border-radius: 12px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--border-color); }

/* Permissions Grid */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.permission-card {
    background: var(--glass-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    transition: 0.3s;
}

.permission-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-teal);
}

.permission-card div {
    font-weight: 600;
    color: var(--text-primary);
}

.status-item-value.on {
    color: var(--accent-green);
    font-weight: bold;
}

.status-item-value.off {
    color: var(--accent-red);
    font-weight: bold;
}

/* Live Location */
#loc-container { position: relative; border-radius: 16px; overflow: hidden; height: 500px; border: 1px solid var(--border-color); }
#map { height: 100%; width: 100%; }
.location-info-header { position: absolute; top: 1rem; left: 1rem; right: 1rem; background: rgba(15, 23, 42, 0.9); padding: 1rem; border-radius: 12px; backdrop-filter: blur(10px); z-index: 500; border: 1px solid var(--border-color); }
.location-footer { position: absolute; bottom: 1rem; right: 1rem; z-index: 500; }
.gmaps-btn { background: white; color: black; padding: 8px 16px; border-radius: 20px; text-decoration: none; font-weight: 600; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }

/* Media Grid */
.media-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.media-card { background: black; border-radius: 12px; overflow: hidden; position: relative; aspect-ratio: 1; border: 1px solid var(--border-color); }
.media-card img, .media-card video { width: 100%; height: 100%; object-fit: cover; }
.media-card-footer { position: absolute; bottom: 0; left: 0; right: 0; padding: 8px; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); display: flex; justify-content: flex-end; }
.download-btn { color: white; background: rgba(255,255,255,0.2); border-radius: 50%; padding: 6px; display: flex; transition: 0.2s; }
.download-btn:hover { background: var(--accent-teal); }
.audio-card { aspect-ratio: auto; padding: 1rem; background: var(--glass-surface); display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.audio-player-wrapper { width: 100%; display: flex; align-items: center; gap: 10px; }
.audio-player-wrapper audio { flex: 1; height: 32px; }


/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
    display: none; justify-content: center; align-items: center; z-index: 2000; padding: 20px; opacity: 0; visibility: hidden; transition: 0.3s;
}
.modal-overlay.visible { opacity: 1; visibility: visible; display: flex; }
.modal-content {
    background: var(--bg-main); border: 1px solid var(--border-color); padding: 2rem; border-radius: 16px; width: 100%; max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6); transform: scale(0.9); transition: 0.3s; display: flex; flex-direction: column; max-height: 90vh;
    overflow-y: auto; overscroll-behavior: contain; /* Enable scrolling inside modal */
}
@media (max-width: 768px) {
    .modal-content.limit-reached-content {
        padding: 1.5rem;
        max-width: 90%;
    }
    .modal-content.limit-reached-content .limit-icon-container {
        width: 60px; height: 60px; margin-bottom: 1rem;
    }
    .modal-content.limit-reached-content .limit-icon-container svg {
        width: 30px; height: 30px;
    }
    .modal-content.limit-reached-content h3 {
        font-size: 1.25rem !important;
    }
    .modal-content.limit-reached-content p {
        font-size: 0.85rem !important; margin-bottom: 15px !important;
    }
}
.modal-overlay.visible .modal-content { transform: scale(1); }
/* Feature Locked Styles */
.category-btn.feature-locked {
    position: relative;
    opacity: 0.7;
    filter: grayscale(80%) blur(0.5px);
    cursor: not-allowed;
    pointer-events: none; /* We will handle clicks via wrapper or listener interception */
}

/* We need to re-enable pointer events for the actual element so JS can catch the click to show the modal, 
   but visually it looks disabled. Actually better: keep pointer events but style it "disabled-ish". */
.category-btn.feature-locked {
    pointer-events: auto !important; 
    cursor: pointer !important;
}

.category-btn.feature-locked::after {
    content: "🔒";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    z-index: 10;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    filter: none !important; /* Attempt to unblur the icon, but parent blur affects it. */
}

/* Better approach: Blur content inside, invalidating :after blur */
.category-btn.feature-locked > * {
    filter: blur(2px);
    opacity: 0.5;
}
.category-btn.feature-locked::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 5;
    border-radius: 16px;
}
.category-btn.feature-locked::after {
    content: "🔒";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    z-index: 10;
    filter: none;
    opacity: 1;
}

/* Limit Reached Modal Professional Styling */
.limit-reached-content {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(255,255,255,0.1);
}
.limit-icon-container {
    width: 80px;
    height: 80px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    border: 2px solid rgba(239, 68, 68, 0.3);
}
.limit-icon-container svg {
    width: 40px;
    height: 40px;
    stroke: #ef4444;
}
.limit-timer {
    background: rgba(15, 23, 42, 0.6);
    padding: 15px;
    border-radius: 8px;
    margin: 1.5rem 0;
    border: 1px solid rgba(255,255,255,0.05);
}
.limit-timer-label {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 5px;
    display: block;
}
.limit-timer-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.5px;
}
.modal-close-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-secondary); cursor: pointer; }
.modal-close-btn:hover { color: var(--accent-red); }
.modal-body { overflow-y: auto; text-align: left; }
.modal-footer { margin-top: 1.5rem; border-top: 1px solid var(--border-color); padding-top: 1rem; display: flex; justify-content: flex-end; gap: 10px; }

.ok-btn {
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-blue));
    color: #0f172a;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(45, 212, 191, 0.2);
}

.ok-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(45, 212, 191, 0.3);
}

/* Image Viewer Modal */
#image-viewer-modal .modal-content-image-viewer { position: relative; max-width: 90%; max-height: 90%; }
.modal-image-content { max-width: 100%; max-height: 80vh; border-radius: 8px; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
.close-image-modal { position: absolute; top: -30px; right: 0; color: white; font-size: 30px; cursor: pointer; }

/* Ad Containers */
.ad-container { display: flex; justify-content: center; margin: 1rem 0; }

/* Notices */
.notice-box { padding: 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; background: rgba(0,0,0,0.2); }
.notice-box.error { border-color: var(--accent-red); color: #fda4af; background: rgba(244, 63, 94, 0.1); }
.notice-box.warning { border-color: #facc15; color: #fde047; background: rgba(234, 179, 8, 0.1); }
.notice-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.notice-btn { padding: 8px 16px; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 0.9rem; }

/* Chat Bubbles (SMS) */
.message-bubble { padding: 10px 14px; border-radius: 12px; max-width: 85%; margin-bottom: 10px; position: relative; }
.message-bubble.incoming { background: var(--glass-surface); border-bottom-left-radius: 2px; }
.message-bubble.outgoing { background: var(--accent-teal); color: #0f172a; border-bottom-right-radius: 2px; margin-left: auto; }
.message-sender { font-size: 0.75rem; opacity: 0.7; margin-bottom: 4px; }
.message-time { font-size: 0.7rem; opacity: 0.6; text-align: right; margin-top: 4px; }

/* Responsive Media Queries */
@media (max-width: 992px) {
    .desktop-nav-links { display: none; }
    .mobile-menu-btn { display: block; }
}

@media (max-width: 768px) {
    .main-content { padding: 1.5rem 1rem; }
    .auth-card { padding: 1.5rem; max-width: 90%; }
    .category-buttons { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}

@media (max-width: 480px) {
    .navbar-brand span { font-size: 1.2rem; }
    .navbar-right { gap: 0.5rem; }
    .category-buttons { grid-template-columns: repeat(2, 1fr); font-size: 0.9rem; }
    .category-btn { min-height: 120px; padding: 1rem; }
    .category-btn svg { width: 28px; height: 28px; }
    .auth-card h2 { font-size: 1.5rem; }
    .status-grid { grid-template-columns: 1fr; }
}
/* ...existing code... */

/* Pricing Modal Styles */
/* Pricing Modal Styles - Modern & Responsive (Full Screen) */
.pricing-modal-content {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    padding: 2rem;
    overflow-y: auto;
    border-radius: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main); /* Ensure solid background */
}

/* Ensure modal header stays at top */
.modal-header {
    position: sticky;
    top: 0;
    background: var(--bg-main);
    z-index: 100; /* Higher z-index to stay above scrolled content */
    padding-bottom: 1rem;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.pricing-grid {
    display: flex;
    flex-wrap: wrap;       
    gap: 15px; /* Tighter gap */
    justify-content: center;
    padding-bottom: 80px;  /* Extra space for safe scrolling on mobile */
    width: 100%;           
}

.plan-card {
    background: var(--glass-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem; /* Reduced padding from 2rem */
    text-align: center;
    flex: 1 1 220px;       /* Smaller basis allows fitting 4 on ~1000px+ screens */
    min-width: 220px;      /* Allow it to shrink a bit more */
    max-width: 380px;      
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, border-color 0.3s;
    position: relative;
    /* overflow: hidden; REMOVED to prevent button cutoff */
    margin-bottom: 10px;   
}

/* Featured 'Gold' Plan Styling */
.plan-card.featured {
    border-color: #f1c40f;
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.1), var(--glass-surface));
    transform: none; /* Removed default scaling to keep aligned with others */
    z-index: 2;
    box-shadow: 0 10px 30px rgba(241, 196, 15, 0.2);
}

.plan-card:hover {
    transform: translateY(-5px); 
    border-color: var(--accent-teal);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.plan-header h3 {
    font-size: 1.3rem; /* Compact font */
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.plan-header .price {
    font-size: 1.8rem; /* Compact font */
    font-weight: 800;
    color: var(--accent-teal);
    margin-bottom: 1.5rem;
}

.plan-card.featured .price {
    color: #f1c40f; /* Gold color for price */
}

.plan-features {
    list-style: none;
    margin-bottom: 1.5rem;
    text-align: left;
    padding: 0 0.5rem;
    flex-grow: 1; /* Pushes button down */
}

.plan-features li {
    margin-bottom: 0.5rem; /* Tighter list */
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem; /* Smaller text */
}

.plan-features li svg {
    flex-shrink: 0;
    stroke: var(--accent-green) !important;
}

.plan-features li svg * {
    stroke: var(--accent-green) !important;
}

/* Allow red color override for disabled features */
.plan-features li svg[stroke="#ef4444"],
.plan-features li svg[stroke="#ef4444"] * {
    stroke: #ef4444 !important;
}

/* Payment Gateway Toggle (India/International) */
.payment-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    position: sticky; /* Make toggle stick under header if needed */
    z-index: 5;
}

.payment-toggle {
    display: flex;
    background: rgba(255,255,255,0.1);
    border-radius: 30px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.toggle-option {
    padding: 10px 24px;
    cursor: pointer;
    border-radius: 25px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: 0.3s;
    user-select: none;
}

.toggle-option.active {
    background: var(--accent-teal);
    color: #0f172a;
    box-shadow: 0 2px 10px rgba(45, 212, 191, 0.3);
}

/* Purchase Button */
.plan-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    font-size: 1rem;
    margin-top: auto; /* Pushes to bottom */
}

/* Button Colors */
.btn-silver { background: #95a5a6; color: white; }
.btn-gold { background: linear-gradient(to right, #f1c40f, #f39c12); color: #000; }
.btn-diamond { background: linear-gradient(to right, #3498db, #2980b9); color: white; }

.plan-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Mobile Responsiveness for Pricing */
@media (max-width: 768px) {
    .pricing-modal-content {
        padding: 1rem;
        width: 100%;
        height: 100%; /* Full screen on mobile */
        max-height: 100vh;
        border-radius: 0; /* Remove corners */
    }

    .plan-card.featured {
        transform: scale(1); /* Reset scaling on mobile to fit flow */
    }
    
    .plan-card:hover {
        transform: translateY(-5px); /* Smaller hover effect */
    }

    .pricing-grid {
        flex-direction: column; /* Stack vertically */
        align-items: center;
    }

    .plan-card {
        width: 100%;
        max-width: 100%; /* Fill width */
    }
}


/* 1. Navbar Fixes for Overlap */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap; /* Prevent wrapping which breaks layout */
}
.desktop-nav-links {
    display: flex;
    gap: 10px;
}
@media (max-width: 900px) {
    /* Hide text in buttons on tablet/smaller screens, show only icon if possible, or shorten text */
    .desktop-nav-links .action-btn span {
        display: none;
    }
    .desktop-nav-links .action-btn {
        padding: 8px; /* Square buttons */
    }
}
@media (max-width: 768px) {
    .desktop-nav-links {
        display: none; /* Move to mobile menu completely on mobile */
    }
    .mobile-menu-btn {
        display: block;
    }
}

/* 2. Map Visibility Fix (Simplified based on Web Admin Panel) */
#loc-container {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden; /* Ensures map corners are rounded */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    margin-top: 1rem; /* Add space between card and map */
}
#map { 
    height: 450px; /* Explicit fixed height, crucial for Leaflet */
    width: 100%; 
    background-color: #000; /* Dark background while tiles load */
}

/* 3. Card View Spacing Fix (User Logs, Call Logs sticking together) */
.data-list {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Adds space between items */
    width: 100%;
}

/* Specific Card Styles for Logs/Notifs to ensure card look */
.keylog-card, .calllog-item, .notification-card-enhanced, .sms-card {
    background: var(--glass-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 0; /* Gap handles spacing */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    width: 100%; /* Full width in list */
    display: block; /* Ensure block formatting */
}
.keylog-card:hover, .calllog-item:hover, .notification-card-enhanced:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
}

/* 4. Notification & Icon Fixes */
.notification-card-enhanced {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.notification-header-enhanced {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
    margin-bottom: 5px;
}
.app-icon svg {
    width: 32px; /* Bigger icons */
    height: 32px;
    display: block;
}

/* 5. Device Status Icon Sizes */
.status-item svg {
    width: 40px !important; /* Force bigger size */
    height: 40px !important;
    min-width: 40px;
}

/* 6. Media Player Fixes */
.audio-player-wrapper audio {
    width: 100%;
    height: 40px;
}
.video-player-wrapper video {
    width: 100%;
    max-height: 300px;
    background: black;
    border-radius: 8px;
}

/* --- CRITICAL FIXES END --- */

/* --- NOTIFICATION UI STYLES --- */
.notification-bell-wrapper {
    position: relative;
}

.notification-bell-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.notification-bell-btn:hover,
.notification-bell-btn:focus {
    color: var(--text-primary);
}

.notification-bell-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.notification-counter {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--accent-red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-main);
}

.notification-list-container {
    position: absolute;
    top: 70px; 
    right: 15px;
    width: 380px;
    max-width: 95vw; /* Responsive width for mobile */
    max-height: 80vh; /* Prevent overflow on small screens */
    overflow-y: auto; /* Enable internal scrolling */
    background: #1e293b;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 2000; /* Ensure it stays on top */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Scrollbar styling for notification list */
.notification-list-container::-webkit-scrollbar {
    width: 6px;
}
.notification-list-container::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 4px;
}

@media (max-width: 480px) {
    .notification-list-container {
        top: 60px;
        right: 0;
        left: 0;
        margin: 0 auto;
        width: 92%;
    }
}

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

.notification-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.notification-list-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.clear-all-btn {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
}
.clear-all-btn:hover {
    text-decoration: underline;
}

.notification-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 350px; /* Reduced height */
    overflow-y: auto;
}

.notification-list li {
    padding: 12px 15px; /* Reduced padding */
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.notification-list li:last-child {
    border-bottom: none;
}

.notification-list li:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.notification-list .no-notifications {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.notification-item-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-item-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.notification-item-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-top: 8px;
    text-align: right;
}

/* Live Chat Styles */
.live-chat-area { display: flex; flex-direction: column; height: 100%; }
.chat-messages { flex-grow: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.chat-bubble { padding: 12px 18px; border-radius: 20px; max-width: 80%; width: fit-content; word-wrap: break-word; line-height: 1.5; }
.chat-bubble.admin, .chat-bubble.auto-reply { background-color: var(--glass-surface); color: var(--text-primary); align-self: flex-start; border-bottom-left-radius: 5px; }
.chat-bubble.user { background: linear-gradient(45deg, var(--accent-teal), var(--accent-purple)); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
.chat-time { font-size: 0.75rem; opacity: 0.7; margin-top: 5px; display: block; text-align: right; }

.chat-input-area { display: flex; padding: 1rem; border-top: 1px solid var(--border-color); gap: 1rem; background: var(--primary-surface); }
.chat-input-area input {
    flex-grow: 1; padding: 14px; border-radius: 10px; border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.2); color: var(--text-primary); font-size: 1rem;
}
.chat-input-area input:focus { outline: none; border-color: var(--accent-teal); }
.chat-input-area button {
    background-color: var(--accent-teal); border: none; border-radius: 10px;
    padding: 0 18px; cursor: pointer; color: #fff; display: flex;
    align-items: center; justify-content: center; transition: background-color 0.3s;
}
.chat-input-area button:hover { background-color: var(--accent-purple); }

/* --- Clean Media Viewer (Strict Cropping) --- */
#clean-media-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95); z-index: 9999;
    display: none; justify-content: center; align-items: center; flex-direction: column;
}
#clean-media-modal.visible { display: flex; animation: fadeIn 0.3s ease; }

.clean-viewer-container {
    width: 90%;
    max-width: 500px; /* Keep it compact */
    /* Strict Height Control to cut off the Footer */
    height: 60vh; 
    max-height: 450px; 
    background: #151515;
    border-radius: 12px;
    overflow: hidden; /* This cuts the extra content */
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    border: 1px solid #333;
}

/* Masking Logic: Shift iframe UP to hide header, Container height hides footer */
.clean-viewer-iframe {
    width: 100%;
    height: 200%; /* Make iframe very tall so footer pushes down */
    border: none;
    position: absolute;
    top: -140px; /* Increased negative margin to hide Header completely */
    left: 0;
    background: #151515;
}

.clean-close-btn {
    position: absolute; top: 20px; right: 20px; color: white;
    font-size: 35px; cursor: pointer; z-index: 10000;
    background: rgba(255, 0, 0, 0.8); width: 40px; height: 40px;
    text-align: center; line-height: 35px; border-radius: 50%;
    transition: 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.clean-close-btn:hover { background: red; transform: scale(1.1); }

/* Card Styling for Dashboard */
.play-btn-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; cursor: pointer; transition: 0.3s;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.6));
}
.play-btn-card:hover { background: rgba(255,255,255,0.05); }
/* Enhanced Notification Card Compact Styles */
.notification-card-enhanced {
    padding: 12px;
    gap: 8px;
}
.notification-title-enhanced {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.notification-text-enhanced {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-secondary);
}
.notification-image-enhanced {
    max-width: 100%;
    border-radius: 6px;
    margin-top: 8px;
}


/* Billing Cycle Selector */
.cycle-btn { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); padding: 8px 16px; border-radius: 20px; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin-bottom: 5px; }
.cycle-btn:hover { border-color: var(--accent-teal); color: white; }
.cycle-btn.active { background: rgba(45, 212, 191, 0.15); border-color: var(--accent-teal); color: var(--accent-teal); font-weight: 500; }
.cycle-btn .badge { font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; background: rgba(46, 204, 113, 0.2); color: #2ecc71; margin-left: 4px; display: inline-block; }

/* --- Chat Enhancements (Full Screen & Ticks) --- */
.modal-content.full-screen {
    max-width: 100vw !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0;
    margin: 0;
    padding: 0;
}

.modal-content.full-screen .modal-header {
    border-radius: 0;
    padding: 1.5rem;
}

.modal-content.full-screen .modal-body {
    height: calc(100vh - 80px); /* Adjust based on header height */
    padding: 0;
}

.modal-content.full-screen .live-chat-area {
    height: 100%;
}

.chat-bubble {
    font-size: 1.05rem; /* Slight increase */
}

.chat-bubble.user {
    /* Ensure relative positioning for ticks if needed, though flex is better */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.tick-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.tick-icon svg {
    width: 100%;
    height: 100%;
}

.tick-icon.read svg {
    stroke: #38bdf8; /* Blue Tick */
}

.modal-expand-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    margin-right: 10px;
}

.modal-expand-btn:hover {
    color: var(--text-primary);
}

/* Telegram Navbar Button - Official Style */
.navbar-telegram-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #24A1DE; /* Official Telegram Color */
    border-radius: 50%;
    margin-right: 8px; /* Reduced gap to bring it closer to bell icon */
    box-shadow: 0 2px 5px rgba(36, 161, 222, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s;
    text-decoration: none;
    animation: telegram-pulse 2s infinite; /* Heartbeat animation */
}

@keyframes telegram-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(36, 161, 222, 0.7);
    }
    70% {
        transform: scale(1.05); /* Slight grow */
        box-shadow: 0 0 0 10px rgba(36, 161, 222, 0); /* Ripple effect */
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(36, 161, 222, 0);
    }
}

.navbar-telegram-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
    stroke: none;
    margin-right: 0; 
    margin-top: 0;
}

.navbar-telegram-btn:hover {
    background-color: #0088cc;
    animation: none; /* Stop animation on hover */
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(36, 161, 222, 0.8);
}

@media (max-width: 768px) {
    /* Adjustments if needed but navbar flex should handle it */
}

/* --- SMS Command Page Styles --- */
.sms-view-header {
    margin-bottom: 20px;
}

.sms-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sms-icon-container {
    background: rgba(56, 189, 248, 0.15);
    padding: 10px;
    border-radius: 12px;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sms-main-title {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-primary);
    font-weight: 600;
}

.sms-sub-title {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sms-card {
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--primary-surface);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    margin: 0 auto;
}

.sms-form-group {
    margin-bottom: 25px;
}

.sms-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--accent-blue);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sms-input-wrapper {
    position: relative;
}

.sms-input-icon {
    position: absolute;
    left: 14px;
    top: 14px;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.sms-input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
}

.sms-input:focus {
    border-color: var(--accent-blue);
    background-color: rgba(56, 189, 248, 0.05);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

.sms-input textarea {
    resize: vertical;
}

.sms-send-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-teal));
    color: #0f172a;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}

.sms-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.35);
}

.sms-send-btn:active {
    transform: scale(0.98);
}

.sms-note {
    margin-top: 25px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}


