/* Google Fonts - Plus Jakarta Sans */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand Colors - Premium Future */
    --primary: #0a2ca2;
    --primary-light: #eef2ff;
    --primary-dark: #061a6b;
    --accent: #f39c12;
    --secondary: #64748b;

    /* UI Colors */
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-alt: #f1f5f9;
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(255, 255, 255, 0.6);

    /* Text Colors */
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --text-white: #ffffff;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Borders & Shadows */
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Spacing */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

ul {
    list-style: none;
}

button {
    font-family: inherit;
}

/* === Layout Utilities === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-4 {
    gap: 1rem;
}

/* === Grid Layouts === */
.ai-data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

#subscriptionPackagesContainer,
#smsPackagesContainer,
#extensionPackagesContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.gap-2 {
    gap: 1rem;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gap-4 {
    gap: 2rem;
}

.w-full {
    width: 100%;
}

.h-screen {
    height: 100vh;
}

.h-full {
    height: 100%;
}

.flex-1 {
    flex: 1;
}

.hidden {
    display: none !important;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

/* === Landing Page Components === */
.hero-section {
    padding: 8rem 0 4rem;
    text-align: center;
    background: radial-gradient(circle at top right, rgba(67, 24, 255, 0.05) 0%, transparent 50%);
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    letter-spacing: -2px;
}

/* Auth Pages */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--background);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.auth-header {
    margin-bottom: 2.5rem;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--secondary);
    max-width: 700px;
    margin: 0 auto 2.5rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    padding: 2rem 0;
}

.feature-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.feature-icon svg {
    width: 30px;
    height: 30px;
}

/* === Typography === */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    font-weight: 700;
}

h1 {
    font-size: 2.5rem;
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-secondary {
    color: var(--text-secondary);
}

.text-primary {
    color: var(--primary);
}

/* === Components === */

/* Buttons - Modernized */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
    text-transform: capitalize;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #6A4BFF 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(67, 24, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(67, 24, 255, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--surface-alt);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 700;
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-danger {
    background: #FF5630;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 86, 48, 0.3);
}

.btn-danger:hover {
    background: #DE350B;
}

/* Cards - Premium Glassmorphism Effect */
.card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid white;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-premium);
}

/* Forms - Modern Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-control,
.form-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control:focus,
.form-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(67, 24, 255, 0.1);
    outline: none;
}

.form-row {
    display: flex;
    gap: 1.5rem;
}

.form-row .form-group {
    flex: 1;
}

/* === Modal - New Centered Premium Design === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    display: none;
    /* JS toggles flex */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    animation: zoomIn 0.3s ease forwards;
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-body {
    padding: 2rem;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}


/* === Sidebar === */
.sidebar {
    width: 280px;
    background: white;
    border-right: none;
    box-shadow: var(--shadow-sm);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.brand-icon {
    color: var(--primary);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    color: var(--secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    position: relative;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 20px rgba(67, 24, 255, 0.2);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    right: -1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 4px;
}

.nav-link svg {
    width: 22px;
    height: 22px;
}


/* === Main Content === */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 2.5rem;
    background: var(--background);
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.page-title {
    font-size: 0.9rem;
    color: var(--secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.page-heading {
    font-size: 2.25rem;
    color: var(--text-main);
    letter-spacing: -1px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 0.75rem 1.25rem;
    border-radius: 40px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: 0.2s;
}

.user-profile:hover {
    box-shadow: var(--shadow-md);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4318FF, #868CFF);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

/* === Custom Feature Components === */

/* QR Code Area */
.qr-container {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 2px dashed var(--border);
}

.qr-placeholder {
    width: 250px;
    height: 250px;
    margin: 0 auto 1.5rem;
    background: var(--surface-alt);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* List Groups */
.auto-reply-list,
.options-list {
    display: grid;
    gap: 1rem;
}

/* Status Dots */
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 12px rgba(5, 205, 153, 0.5);
}

.status-dot.disconnected {
    background: var(--danger);
}

.status-dot.waiting {
    background: var(--warning);
    animation: pulse 1s infinite;
}

/* Chat Window */
.chat-window {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    height: calc(90vh - 100px);
    border: 1px solid var(--border);
}

.chat-list {
    width: 360px;
    border-right: 1px solid var(--border);
    background: white;
    overflow-y: auto;
}

.chat-item {
    transition: 0.2s;
    border-bottom: 1px solid var(--border);
}

.chat-item:hover {
    background: var(--primary-light);
}

.chat-item.active {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
}

.chat-view {
    flex: 1;
    background: #e5ddd5;
    background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png");
    display: flex;
    flex-direction: column;
}

.message-bubble {
    max-width: 70%;
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1.4;
}

.message-bubble.received {
    background: white;
    border-top-left-radius: 2px;
    align-self: flex-start;
}

.message-bubble.sent {
    background: #dcf8c6;
    border-top-right-radius: 2px;
    align-self: flex-end;
}


/* Auto Reply & Menu List Items */
.list-item-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
}

.list-item-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    border-left: 5px solid var(--success);
    animation: slideIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* === Grid Utilities (Tailwind-like) === */
.grid {
    display: grid;
}

.gap-6 {
    gap: 1.5rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Meta / Instagram Messaging Styles */
.meta-message-sent {
    background: linear-gradient(45deg, #833ab4, #fd1d1d, #fcb045);
    color: white;
    border-radius: 18px 18px 4px 18px;
    align-self: flex-end;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.meta-message-received {
    background-color: #f0f0f0;
    color: #000;
    border-radius: 18px 18px 18px 4px;
    align-self: flex-start;
}

.meta-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.meta-avatar-placeholder {
    background: linear-gradient(45deg, #405de6, #5851db, #833ab4, #c13584, #e1306c, #fd1d1d);
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.chat-view.meta-chat-view {
    background-image: none !important;
    background-color: #ffffff;
}

/* Refined Footer Styles - User Request */
.footer {
    background: #0f172a;
    /* Dark background */
    color: white;
    padding: 1rem 0 1.5rem;
    /* Reduced vertical padding */
}

/* Ensure grid layout */
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    /* Reduced gap */
    margin-bottom: 2rem;
}

.footer h4 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Contact Box Refinements */
.contact-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem !important;
    /* Force reduced padding */
    margin-bottom: 0.75rem !important;
    /* Force reduced bottom margin */
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80px;
    /* Ensure a minimum height for consistency */
}

.contact-icon {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-box p {
    margin: 0;
    line-height: 1.4;
    font-size: 0.9rem;
}

/* Footer bottom text spacing */
.footer>.container>div:last-child {
    padding-top: 1.5rem !important;
    margin-top: 0 !important;
    font-size: 0.8rem;
}

/* Header Menu Styles */
.desktop-menu {
    display: none;
    /* Hidden by default on mobile */
}

.nav-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    letter-spacing: 0.5px;
}

.nav-link:hover {
    color: var(--primary);
}

@media (min-width: 768px) {
    .desktop-menu {
        display: flex !important;
    }
}

html {
    scroll-behavior: smooth;
}

/* === Mobile Responsiveness === */

/* Hamburger Menu Button - Hidden on Desktop */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.5rem;
    margin-right: 0.5rem;
}

/* Sidebar Overlay - Hidden by default */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9;
    /* Below sidebar (10), above everything else */
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {

    /* Main Content */
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    /* Sidebar - Hidden by default */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    /* Sidebar Active State */
    .sidebar.active {
        transform: translateX(0);
    }

    /* Show Hamburger Button */
    .mobile-menu-btn {
        display: block;
    }

    /* Adjust Header */
    .header {
        position: sticky;
        top: 0;
        z-index: 5000;
        /* Higher than charts but below sidebar */
        background: #ffffff !important;
        /* Force solid white background */
        padding: 0.75rem 0.5rem;
        margin-bottom: 1rem;
        border-bottom: 2px solid var(--primary-light);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .page-heading {
        font-size: 1.75rem;
    }

    .form-row {
        flex-wrap: wrap;
        gap: 10px !important;
    }

    /* Adjust Grid Layouts */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .charts-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    /* Purchase Modal Cards - Allow 2 columns if space permits, else PC-like density */
    #subscriptionPackagesContainer,
    #smsPackagesContainer,
    #extensionPackagesContainer {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    }

    /* Chat Window */
    .chat-window {
        flex-direction: column;
        height: calc(100vh - 150px);
    }

    .chat-list {
        width: 100%;
        height: 30%;
        /* Show list at top */
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .chat-view {
        height: 70%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        /* Keep 2 columns even on tiny screens */
    }

    .charts-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .user-profile span {
        display: none !important;
    }
    
    .user-profile {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        justify-content: center !important;
        border-radius: 50% !important;
    }

    .user-profile svg {
        margin: 0 !important;
    }
}

/* === Mobile Fixes (Round 2) === */

/* 1. Sidebar Scrolling */
.sidebar {
    overflow-y: auto;
    /* Enable vertical scrolling */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
}

/* 2. Chat Bubbles Overflow */
.message-bubble {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* 3. Table Responsiveness (Global) */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 4. Global Button Icon Alignment Fix - User Request */
.btn svg, .ab-btn svg, .nav-link svg, .action-btn svg {
    vertical-align: middle;
    margin-top: -2px; /* Slight adjustment to center icons with text */
}

.btn, .ab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 5. SMS Modal Mobile Optimization (Aggressive & Cleaned) */
@media (max-width: 768px) {
    #smsModal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        display: flex;
        flex-direction: column;
    }

    #smsModal .modal-body {
        padding: 1rem !important;
        flex: 1 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        background: #f8fafc !important;
    }

    #smsModal .modal-header {
        padding: 1rem !important;
        background: #fff !important;
        border-bottom: 1px solid #e2e8f0 !important;
        z-index: 100 !important;
        flex-shrink: 0;
    }

    /* Packages grid layout for mobile */
    #subscriptionPackagesContainer,
    #smsPackagesContainer,
    #extensionPackagesContainer,
    #apiAccessPackagesContainer {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Card adjustments for mobile */
    .package-card {
        margin-bottom: 0 !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
    }

    /* PayTR/Checkout Container UI */
    #paytrIframeContainer {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 1 !important;
        display: none; /* Default hidden, controlled by JS */
        flex-direction: column !important;
    }

    iframe#paytrIframe {
        width: 100% !important;
        flex: 1 !important;
        min-height: 450px;
        border: none !important;
    }
    /* 7. General Modal Mobile Fix (Other Modals) */
    .modal-content:not(#smsModal .modal-content) {
        width: 95% !important;
        max-width: 95% !important;
        margin: auto;
    }

    /* 8. Desktop-Like Density for Mobile */
    .stats-grid,
    .charts-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .ai-data-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    #page-menu>div {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .main-content {
        padding: 0.5rem !important;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* === Persistent Mobile Fixes === */
/* Force Sidebar to be on top of EVERYTHING */
.sidebar {
    z-index: 10000 !important;
    height: 100vh;
    overflow-y: auto;
}

/* Ensure Overlay is just below Sidebar but above everything else */
.sidebar-overlay {
    z-index: 9999 !important;
}