/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #db8a70;
    --primary-hover: #c77959;
    --text-dark: #2d2d2d;
    --text-light: #888888;
    --text-muted: #a0a0a0;
    --bg-white: #ffffff;
    --bg-light: #fafafa;
    --bg-cream: #fdf9f7;
    --border-color: #e8e8e8;
    --border-light: #f0f0f0;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 12px 40px rgba(219, 138, 112, 0.12);
    --shadow-luxe: 0 20px 60px rgba(0, 0, 0, 0.06);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-in-out;
    --transition-luxe: all 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 40px;
    --spacing-xl: 64px;
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
}

/* Iframe and Mobile optimizations */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    /* Critical for iOS scrolling */
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-cream);
    color: var(--text-dark);
    line-height: 1.75;
    letter-spacing: 0.01em;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    font-weight: 400;
}

/* iOS Safari viewport fix */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
}

a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease, text-decoration-color 0.3s ease;
}

a:hover,
a:focus {
    color: var(--primary-hover);
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

a:focus-visible {
    outline: 2px solid var(--primary-hover);
    outline-offset: 4px;
}

a.btn,
.btn a {
    color: inherit;
    text-decoration: none;
}

/* Iframe-ready: Remove default margins if embedded */
body.embedded,
body.in-iframe {
    margin: 0;
    padding: 0;
}

/* Mobile-specific body fixes */
body.is-mobile,
body.touch-device {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    position: relative !important;
}

/* Prevent iOS double-tap zoom */
a, button, input, select, textarea {
    touch-action: manipulation;
}

/* Mobile touch-friendly targets (44px minimum) */
@media (max-width: 768px) {
    .btn, 
    .nav-link, 
    .nav-menu a,
    button {
        min-height: 44px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    
    input, select, textarea {
        min-height: 44px;
        font-size: 16px !important; /* Prevents iOS zoom */
    }
}

/* Login Page Styles */
.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #fff 0%, #f9f9f9 100%);
}

.login-card {
    background: var(--bg-white);
    padding: 50px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    width: 100%;
}

.logo-section {
    text-align: center;
    margin-bottom: 40px;
}

.logo-section h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.tagline {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 400;
}

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

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-message {
    background: #ffe6e6;
    color: #d63031;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
}

.btn {
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: #ffffff !important;
    width: 100%;
    box-shadow: 0 4px 12px rgba(219, 138, 112, 0.25);
    transition: var(--transition-luxe);
}

/* Ensure button text is always readable - white on primary buttons */
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
a.btn-primary,
button.btn-primary {
    color: #ffffff !important;
    text-decoration: none !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #b86948 100%);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(219, 138, 112, 0.3);
}

.btn-secondary {
    background-color: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid transparent;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: var(--transition-luxe);
}

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

.btn-sm {
    font-size: 14px;
    padding: 8px 16px;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    background-color: var(--bg-light);
    color: var(--text-dark);
    text-transform: uppercase;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    font-size: 14px;
    color: var(--text-light);
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--bg-white);
    padding: 30px 20px;
    border-right: 1px solid var(--border-light);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1010;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease;
    background-clip: padding-box;
    box-shadow: none;
}

/* DESKTOP: Client dashboard sidebar visible by default */
@media (min-width: 969px) {
    .client-dashboard-page .sidebar {
        transform: translateX(0) !important;
    }
    
    .client-dashboard-page .main-content {
        margin-left: 280px;
    }
    
    /* Hide hamburger on desktop overview */
    .client-dashboard-page .sidebar-toggle {
        display: none;
    }
    
    /* When viewing a module, collapse sidebar */
    .client-dashboard-page.module-focus .sidebar {
        transform: translateX(-100%) !important;
    }
    
    .client-dashboard-page.module-focus .main-content {
        margin-left: 0;
    }
    
    /* Show hamburger when in module focus */
    .client-dashboard-page.module-focus .sidebar-toggle {
        display: inline-flex;
    }
    
    /* When hamburger clicked in module focus, show sidebar */
    .client-dashboard-page.module-focus.sidebar-open .sidebar {
        transform: translateX(0) !important;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
    }
}

/* Admin page: sidebar ALWAYS visible */
.admin-page .sidebar,
.admin-dashboard .sidebar,
body.admin-page .sidebar {
    transform: translateX(0) !important;
    position: fixed !important;
    left: 0 !important;
}

.admin-page .main-content,
.admin-dashboard .main-content,
body.admin-page .main-content {
    margin-left: 280px !important;
}

/* Admin pages should NEVER hide sidebar */
.admin-page.module-focus .sidebar,
.admin-page.sidebar-open .sidebar {
    transform: translateX(0) !important;
}

.sidebar-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.sidebar-header .user-name {
    font-size: 14px;
    color: var(--text-light);
}

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

.nav-menu li {
    margin-bottom: 8px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-menu .nav-link-external {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.nav-menu .nav-link-external:hover {
    background-color: var(--primary-color);
    color: white;
}

.nav-menu .icon {
    margin-right: 12px;
    font-size: 20px;
}

.main-content {
    flex: 1;
    margin-left: 0;
    padding: clamp(32px, 5vw, 72px);
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-scaffold {
    display: flex;
    flex-direction: column;
    gap: clamp(28px, 5vw, 48px);
}

.content-primary {
    display: flex;
    flex-direction: column;
    gap: clamp(32px, 4vw, 48px);
    min-width: 0;
}



@media (min-width: 1100px) {
    .content-scaffold {
        max-width: 1200px;
        margin: 0 auto;
    }
}

.page-header {
    margin-bottom: var(--spacing-xl);
    text-align: left;
}

.page-header h1 {
    font-size: clamp(28px, 4vw, 42px);
    color: var(--text-dark);
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.page-header p {
    font-size: 17px;
    color: var(--text-light);
    max-width: 600px;
    line-height: 1.7;
    font-weight: 400;
}

/* Module Cards */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: clamp(28px, 4vw, 48px);
    margin-bottom: clamp(40px, 6vw, 80px);
}

/* Fade-in animation for cards */
.module-card {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.module-card:nth-child(1) { animation-delay: 0.1s; }
.module-card:nth-child(2) { animation-delay: 0.2s; }
.module-card:nth-child(3) { animation-delay: 0.3s; }
.module-card:nth-child(4) { animation-delay: 0.4s; }
.module-card:nth-child(5) { animation-delay: 0.5s; }
.module-card:nth-child(6) { animation-delay: 0.6s; }
.module-card:nth-child(7) { animation-delay: 0.7s; }
.module-card:nth-child(8) { animation-delay: 0.8s; }

.module-card {
    background: linear-gradient(155deg, #ffffff 0%, #fdf9f7 100%);
    border: 1px solid rgba(219, 138, 112, 0.15);
    border-radius: var(--radius-lg);
    padding: clamp(32px, 4vw, 44px);
    cursor: pointer;
    transition: var(--transition-luxe);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    isolation: isolate;
}

.module-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(219, 138, 112, 0.18), rgba(255, 255, 255, 0));
    opacity: 0.6;
    transition: opacity 0.5s ease;
    z-index: -1;
}

.module-card::after {
    content: '';
    position: absolute;
    top: -60%;
    left: -40%;
    width: 220%;
    height: 220%;
    background: radial-gradient(circle at 18% 18%, rgba(219, 138, 112, 0.22), transparent 55%);
    transform: translate3d(-12px, 0, 0) rotate(10deg);
    transition: transform 0.7s ease, opacity 0.7s ease;
    opacity: 0.65;
    z-index: -2;
}

.module-card:hover::before {
    opacity: 0.85;
}

.module-card:hover::after {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0.9;
}

.module-card:hover {
    border-color: rgba(219, 138, 112, 0.25);
    box-shadow: 0 16px 48px rgba(219, 138, 112, 0.12), 0 4px 16px rgba(0, 0, 0, 0.04);
    transform: translateY(-6px);
}

.module-card:active {
    transform: translateY(-4px) scale(1.01);
}

.module-card .icon {
    font-size: 36px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.module-card h3 {
    font-size: clamp(20px, 1.5rem, 26px);
    color: var(--text-dark);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: var(--spacing-sm);
    line-height: 1.3;
}

.module-card p {
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
    line-height: 1.75;
    font-weight: 400;
}

.progress-bar {
    height: 6px;
    background: rgba(219, 138, 112, 0.08);
    border-radius: 999px;
    overflow: hidden;
    margin-top: var(--spacing-md);
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    background-size: 200% 100%;
    animation: progressShine 2s ease-in-out infinite;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 999px;
    position: relative;
    box-shadow: 0 6px 18px rgba(219, 138, 112, 0.35);
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    animation: progressGlide 1.5s ease-in-out infinite;
}

@keyframes progressShine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes progressGlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Sidebar & Module Focus States */
body.module-focus {
    background-color: var(--bg-cream);
}

body.module-focus .dashboard {
    background: var(--bg-cream);
}

body.module-focus .main-content {
    margin-left: 0;
    padding: clamp(32px, 5vw, 72px);
    min-height: 100vh;
}

body.module-focus .legal-footer {
    margin-left: 0;
    width: 100%;
    background: transparent;
}

body.module-focus .legal-footer p,
body.module-focus .legal-footer .disclaimer {
    color: var(--text-light);
}

body.module-focus .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
}

/* Show hamburger toggle only in module focus mode on desktop */
.client-dashboard .sidebar-toggle {
    display: none;
}

body.module-focus .client-dashboard .sidebar-toggle {
    display: inline-flex;
}

body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.12);
}

body.sidebar-open.module-focus .sidebar {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(33, 33, 33, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1005;
}

body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    box-shadow: 0 18px 35px rgba(219, 138, 112, 0.25);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sidebar-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: white;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.sidebar-toggle span + span {
    margin-top: 6px;
}

body.sidebar-open .sidebar-toggle span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

body.sidebar-open .sidebar-toggle span:nth-child(2) {
    opacity: 0;
}

body.sidebar-open .sidebar-toggle span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.sidebar-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 45px rgba(219, 138, 112, 0.28);
}

.sidebar-toggle:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 4px;
}

.client-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: clamp(24px, 4vw, 48px);
}

.client-topbar__title {
    flex: 1;
    font-size: clamp(22px, 3vw, 34px);
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.client-topbar__support {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.client-topbar__support:hover,
.client-topbar__support:focus-visible {
    color: var(--text-dark);
    border-color: currentColor;
    outline: none;
}

body.module-focus .client-topbar {
    margin-bottom: clamp(32px, 5vw, 56px);
}

body.module-focus .module-shell {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    gap: clamp(40px, 6vw, 72px);
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: clamp(40px, 6vw, 64px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-luxe);
}

body.module-focus .module-navigator {
    background: var(--bg-cream);
    border-radius: var(--radius-md);
    padding: clamp(24px, 4vw, 36px);
    border: 1px solid var(--border-light);
    box-shadow: none;
    position: sticky;
    top: clamp(80px, 10vh, 120px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.module-navigator::-webkit-scrollbar {
    width: 6px;
}

.module-navigator::-webkit-scrollbar-thumb {
    background: rgba(219, 138, 112, 0.35);
    border-radius: 999px;
}

.module-navigator__header {
    display: grid;
    gap: 8px;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.module-navigator__eyebrow {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 600;
}

.module-navigator__note {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.7;
    display: none;
}

.module-nav-list {
    display: grid;
    gap: 6px;
}

.module-nav-empty {
    color: var(--text-light);
    font-style: normal;
    line-height: 1.7;
    font-size: 14px;
}

.module-nav-link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    color: var(--text-dark);
    transition: background 0.25s ease, color 0.25s ease;
    width: 100%;
}

.module-nav-link__bullet {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color);
    margin-top: 6px;
    flex-shrink: 0;
    transition: background 0.25s ease, transform 0.25s ease;
}

.module-nav-link__title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-dark);
}

.module-nav-link:hover,
.module-nav-link:focus {
    background: #ffffff;
    outline: none;
}

.module-nav-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.module-nav-link.active {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.module-nav-link.active .module-nav-link__bullet {
    background: var(--primary-color);
}

body.module-focus .module-main {
    background: transparent;
    border-radius: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(32px, 4vw, 48px);
}

.module-header {
    display: grid;
    gap: var(--spacing-sm);
}

.module-title {
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.module-subtitle {
    font-size: 17px;
    color: var(--text-light);
    line-height: 1.75;
    max-width: 640px;
    font-weight: 400;
}

.module-back {
    justify-self: flex-start;
    margin-bottom: var(--spacing-sm);
}

.module-nav-back {
    width: 100%;
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.module-content-area {
    display: grid;
    gap: clamp(24px, 3vw, 32px);
}

/* Floating Back Button */
.floating-back-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 50px;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(219, 138, 112, 0.35);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.floating-back-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(219, 138, 112, 0.45);
}

.floating-back-btn span {
    font-size: 18px;
}

body.module-focus .content-section {
    border-color: rgba(219, 138, 112, 0.32);
    box-shadow: 0 36px 84px rgba(24, 28, 37, 0.16);
}

body.module-focus .content-header {
    padding: clamp(24px, 3vw, 32px);
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.92), rgba(249, 245, 242, 0.86));
}

body.module-focus .content-body {
    padding: clamp(24px, 3vw, 34px);
}

.module-cta-panel {
    background: linear-gradient(135deg, rgba(219, 138, 112, 0.1) 0%, rgba(219, 138, 112, 0.25) 100%);
    border-radius: 20px;
    padding: clamp(24px, 3vw, 36px);
    border: 1px solid rgba(219, 138, 112, 0.3);
    display: grid;
    gap: 12px;
    text-align: left;
}

.module-cta-button {
    align-self: flex-start;
}

/* Content Items - Luxe Styling */
.content-section {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    transition: var(--transition-luxe);
}

.content-section::before {
    display: none;
}

.content-section:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    border-color: rgba(219, 138, 112, 0.2);
}

.content-section:hover::before {
    display: none;
}

.content-header {
    padding: clamp(28px, 4vw, 36px);
    background: #ffffff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    position: relative;
    z-index: 1;
    transition: background 0.3s ease;
    border-bottom: 1px solid transparent;
}

.content-header:hover {
    background: var(--bg-cream);
}

.content-header.expanded {
    border-bottom-color: var(--border-light);
}

.content-header h4 {
    font-size: clamp(17px, 1.25rem, 21px);
    color: var(--text-dark);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

.content-header .toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(219, 138, 112, 0.14);
    color: var(--primary-color);
    font-size: 18px;
    transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.content-header:hover .toggle-icon {
    background: rgba(219, 138, 112, 0.22);
    color: var(--primary-hover);
}

.content-header.expanded .toggle-icon {
    transform: rotate(180deg);
}

.content-body {
    padding: clamp(28px, 4vw, 40px);
    display: none;
    background: #ffffff;
    position: relative;
    z-index: 1;
    color: var(--text-dark);
}

.content-body.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.content-body p {
    margin-bottom: var(--spacing-md);
    line-height: 1.85;
    font-size: 16px;
    color: var(--text-dark);
}

.content-body a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(219, 138, 112, 0.3);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

.content-body a:hover {
    text-decoration-color: var(--primary-color);
}

.content-body ul,
.content-body ol {
    margin: 0 0 var(--spacing-md) var(--spacing-md);
    color: inherit;
    line-height: 1.9;
}

.content-body li {
    margin-bottom: 10px;
    padding-left: 8px;
}

.content-body li + li {
    margin-top: 0;
}

.content-body blockquote {
    border-left: 4px solid rgba(219, 138, 112, 0.35);
    padding-left: 18px;
    font-style: italic;
    color: rgba(45, 45, 45, 0.75);
    background: rgba(219, 138, 112, 0.08);
    border-radius: 12px;
}

.content-body code {
    background: rgba(33, 33, 33, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: 'Fira Code', 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
}

.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin: 24px 0;
    border-radius: 16px;
    box-shadow: 0 30px 70px rgba(24, 28, 37, 0.18);
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 16px;
}

.download-button {
    display: inline-flex;
    align-items: center;
    margin: 10px 10px 10px 0;
}

.download-button .btn {
    text-decoration: none;
}

.completion-checkbox {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.completion-checkbox label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-dark);
}

.completion-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

/* CTA Sections */
.cta-banner {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin: 30px 0;
    text-align: center;
}

.cta-banner h3 {
    font-size: 24px;
    margin-bottom: 15px;
}

.cta-banner p {
    font-size: 16px;
    margin-bottom: 20px;
    opacity: 0.95;
}

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

.cta-banner .btn:hover {
    background-color: #f9f9f9;
}

/* Admin Container (for module-builder, file-upload, etc.) */
.admin-container {
    display: flex;
    min-height: 100vh;
}

.admin-container .sidebar {
    width: 260px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-light);
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.admin-container .sidebar .logo {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    padding: 0 12px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.admin-container .sidebar .nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-container .sidebar .nav-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.admin-container .sidebar .nav-item:hover {
    background: var(--bg-light);
}

.admin-container .sidebar .nav-item.active {
    background: var(--primary-color);
    color: white;
}

.admin-container .main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px 40px;
    background: var(--bg-cream);
    min-height: 100vh;
}

/* Admin Styles */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.admin-actions {
    display: flex;
    gap: 15px;
}

.table-container {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: var(--bg-light);
}

th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

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

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.btn-icon {
    padding: 6px 12px;
    font-size: 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
}

.btn-icon:hover {
    background-color: var(--bg-light);
    transform: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

/* Greeting modal placed front-and-center for immediate attention */
#greetingModal.modal {
    align-items: flex-start;
    justify-content: center;
    padding: clamp(6vh, 10vh, 160px) 20px 40px;
}

#greetingModal .modal-content {
    margin: 0;
    max-width: 520px;
    width: min(92%, 520px);
    animation: slideUpFade 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center top;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-white);
    padding: 40px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    font-size: 24px;
    color: var(--text-dark);
}

.close-modal {
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-dark);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    transition: border-color 0.3s ease;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}

/* Luxe Rich Text Editor Overrides */
.ql-toolbar.ql-snow {
    border: 2px solid var(--border-color);
    border-radius: 16px 16px 0 0;
    background: linear-gradient(135deg, #ffffff 0%, #fff5f0 100%);
    box-shadow: var(--shadow);
    padding: 14px 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 0;
    transition: var(--transition-luxe);
}

.ql-toolbar.ql-snow .ql-formats {
    margin-right: 8px;
}

.ql-toolbar.ql-snow .ql-formats:last-of-type {
    margin-right: 0;
}

.ql-toolbar.ql-snow button {
    border-radius: 10px;
    transition: var(--transition-fast);
    color: var(--text-dark);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ql-toolbar.ql-snow button:hover {
    background: rgba(219, 138, 112, 0.12);
    color: var(--primary-color);
}

.ql-toolbar.ql-snow button.ql-active,
.ql-toolbar.ql-snow button.ql-active:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(219, 138, 112, 0.25);
}

.ql-snow .ql-toolbar button .ql-fill,
.ql-snow .ql-toolbar button .ql-stroke {
    fill: currentColor;
    stroke: currentColor;
}

.ql-snow .ql-picker {
    color: var(--text-dark);
    border-radius: 10px;
    transition: var(--transition-fast);
}

.ql-snow .ql-picker:hover .ql-picker-label,
.ql-snow .ql-picker.ql-expanded .ql-picker-label {
    color: var(--primary-color);
}

.ql-snow .ql-picker-label {
    border: none;
    padding: 6px 12px;
    border-radius: 10px;
}

.ql-snow .ql-picker-label:hover {
    background: rgba(219, 138, 112, 0.08);
}

.ql-snow .ql-picker-options {
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.12);
    padding: 6px;
}

.ql-snow .ql-picker-item {
    border-radius: 8px;
    padding: 6px 10px;
}

.ql-snow .ql-picker-item:hover,
.ql-snow .ql-picker-item.ql-selected {
    background: rgba(219, 138, 112, 0.12);
    color: var(--primary-color);
}

.ql-container.ql-snow {
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 16px 16px;
    box-shadow: var(--shadow);
    transition: var(--transition-luxe);
    background-color: var(--bg-white);
    margin-top: 0;
    margin-bottom: 28px;
}

.ql-container.ql-snow .ql-editor {
    min-height: 220px;
    padding: 24px;
    font-size: 16px;
    line-height: 1.75;
    color: var(--text-dark);
}

.ql-container.ql-snow .ql-editor.ql-blank::before {
    color: var(--text-light);
    font-style: italic;
}

.ql-toolbar.ql-snow:focus-within,
.ql-container.ql-snow:focus-within,
.ql-toolbar.ql-snow:focus-within + .ql-container.ql-snow {
    border-color: var(--primary-color);
    box-shadow: 0 22px 45px rgba(219, 138, 112, 0.18);
}

.ql-container.ql-snow .ql-editor:focus {
    outline: none;
}

.ql-editor a {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 600;
}

body.night-mode .ql-toolbar.ql-snow {
    background: linear-gradient(135deg, #1f1f1f 0%, #252525 100%);
    border-color: #4a4a4a;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

body.night-mode .ql-toolbar.ql-snow button {
    color: #f5f5f5;
}

body.night-mode .ql-toolbar.ql-snow button:hover {
    background: rgba(219, 138, 112, 0.25);
    color: var(--primary-color);
}

body.night-mode .ql-toolbar.ql-snow button.ql-active,
body.night-mode .ql-toolbar.ql-snow button.ql-active:hover {
    color: #ffffff;
    box-shadow: 0 8px 22px rgba(219, 138, 112, 0.35);
}

body.night-mode .ql-snow .ql-picker {
    color: #f5f5f5;
}

body.night-mode .ql-snow .ql-picker-label:hover,
body.night-mode .ql-snow .ql-picker.ql-expanded .ql-picker-label {
    background: rgba(219, 138, 112, 0.18);
}

body.night-mode .ql-snow .ql-picker-options {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.7);
    background-color: #1f1f1f;
}

body.night-mode .ql-container.ql-snow {
    background-color: #1e1e1e;
    border-color: #4a4a4a;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.65);
}

body.night-mode .ql-container.ql-snow .ql-editor {
    color: #f5f5f5;
}

body.night-mode .ql-container.ql-snow .ql-editor.ql-blank::before {
    color: #b5b5b5;
}

body.night-mode .ql-toolbar.ql-snow:focus-within,
body.night-mode .ql-container.ql-snow:focus-within,
body.night-mode .ql-toolbar.ql-snow:focus-within + .ql-container.ql-snow {
    border-color: var(--primary-color);
    box-shadow: 0 24px 54px rgba(219, 138, 112, 0.32);
}

/* Legal Footer */
.legal-footer {
    background-color: var(--bg-light);
    padding: 30px 40px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    margin-left: 0;
    width: 100%;
    box-sizing: border-box;
    /* Ensure footer is NOT sticky/fixed */
    position: relative;
}

/* Footer on login page (no sidebar) */
.login-container ~ .legal-footer {
    margin-left: 0;
    width: 100%;
}

.legal-footer p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 10px;
    line-height: 1.6;
    text-align: center;
}

.legal-footer .disclaimer {
    font-size: 11px;
    max-width: 900px;
    margin: 15px auto 0;
    line-height: 1.7;
    text-align: center;
}

/* Responsive Module Layout */
@media (max-width: 1200px) {
    body.module-focus .module-shell {
        max-width: 1000px;
    }
}

@media (max-width: 1100px) {
    body.module-focus .module-shell {
        grid-template-columns: 1fr;
        padding: clamp(20px, 4vw, 32px);
    }
    
    body.module-focus .module-main {
        order: 1;
    }
    
    body.module-focus .module-navigator {
        order: 2;
        position: relative;
        top: auto;
        max-height: none;
    }
}

@media (max-width: 900px) {
    .client-topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
    
    .client-topbar__support {
        align-self: flex-start;
        display: inline-flex;
    }
}

@media (max-width: 768px) {
    .sidebar-toggle {
        width: 44px;
        height: 44px;
    }
    
    body.module-focus .module-shell {
        padding: clamp(18px, 5vw, 28px);
    }
    
    body.module-focus .module-main {
        padding: clamp(22px, 5vw, 32px);
    }
    
    body.module-focus .module-navigator {
        padding: clamp(18px, 4vw, 26px);
    }
}

@media (max-width: 600px) {
    body.module-focus .module-shell {
        padding: clamp(16px, 6vw, 24px);
    }
    
    body.module-focus .module-main,
    body.module-focus .module-navigator {
        padding: clamp(18px, 5vw, 26px);
        border-radius: 20px;
    }
    
    .client-topbar {
        gap: 12px;
    }
}

/* Responsive Design */
@media (max-width: 968px) {
    /* Client dashboard: collapse sidebar on tablet/mobile */
    .client-dashboard .sidebar {
        transform: translateX(-100%);
    }
    
    .client-dashboard .main-content {
        margin-left: 0 !important;
    }
    
    /* Show hamburger on mobile for client dashboard */
    .client-dashboard .sidebar-toggle {
        display: inline-flex !important;
    }
    
    /* Admin dashboard: keep sidebar visible but adjust */
    .admin-dashboard .sidebar {
        width: 240px;
    }
    
    .admin-dashboard .main-content {
        margin-left: 240px !important;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .legal-footer {
        margin-left: 0;
        width: 100%;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .login-card {
        padding: 30px;
    }
    
    .page-header h1 {
        font-size: 26px;
    }
    
    /* Floating back button - adjust position on mobile */
    .floating-back-btn {
        bottom: 20px;
        right: 20px;
        padding: 12px 20px;
        font-size: 13px;
    }
}

@media (max-width: 600px) {
    .modal-content {
        padding: 25px;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .admin-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .admin-actions .btn {
        width: 100%;
    }
    
    .legal-footer {
        padding: 20px 15px;
    }
    
    .legal-footer p {
        font-size: 12px;
    }
    
    .legal-footer .disclaimer {
        font-size: 10px;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 10px;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.loading::after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Loading Overlay */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(249, 249, 249, 0.98) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.4s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 60px;
    height: 60px;
    position: relative;
}

.spinner::before,
.spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.spinner::before {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(219, 138, 112, 0.2);
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.spinner::after {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(219, 138, 112, 0.1);
    border-top-color: var(--primary-hover);
    top: 6px;
    left: 6px;
    animation: spin 0.7s linear infinite reverse;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-text {
    margin-top: 25px;
    font-size: 18px;
    color: var(--text-dark);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.spinner-subtext {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-light);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, #ffffff 0%, #fdf9f7 50%, #faf5f2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* Luxe Loading Animation - Elegant Morphing Blob */
.loading-spinner {
    width: 80px;
    height: 80px;
    position: relative;
}

.loading-spinner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: luxeMorph 8s ease-in-out infinite;
    opacity: 0.9;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    inset: 8px;
    background: linear-gradient(145deg, #ffffff 0%, #fdf9f7 100%);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: luxeMorph 8s ease-in-out infinite reverse;
    animation-delay: -4s;
}

@keyframes luxeMorph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
    }
    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
    }
}



/* Luxe Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-text {
    margin-top: 32px;
    font-size: 18px;
    color: var(--text-dark);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.loading-subtext {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-light);
    font-weight: 400;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none;
}

/* Night Mode Toggle Switch */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

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

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

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

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

/* Night Mode Styles - ADA Compliant */
body.night-mode {
    background-color: #121212;
    color: #ffffff;
}

body.night-mode .sidebar {
    background-color: #1e1e1e;
    border-right: 1px solid #4a4a4a;
}

body.night-mode .main-content {
    background-color: #121212;
}

body.night-mode .card,
body.night-mode .content-item,
body.night-mode .cta-banner,
body.night-mode .modal-content {
    background-color: #1e1e1e;
    color: #ffffff;
    border-color: #4a4a4a;
}

body.night-mode .page-header h1,
body.night-mode .card h2,
body.night-mode .card h3 {
    color: #ffffff;
}

body.night-mode .nav-link {
    color: #e0e0e0;
}

body.night-mode .nav-link:hover,
body.night-mode .nav-link.active {
    color: #ffffff;
    background-color: #333333;
}

body.night-mode .client-topbar__title {
    color: #f5f5f5;
}

body.night-mode .client-topbar__support {
    color: rgba(255, 198, 180, 0.9);
    border-color: transparent;
}

body.night-mode .client-topbar__support:hover,
body.night-mode .client-topbar__support:focus-visible {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.45);
}

body.night-mode .module-navigator__note {
    color: rgba(235, 235, 235, 0.7);
}

body.night-mode .btn-secondary {
    background-color: #333333;
    color: #ffffff;
}

body.night-mode .btn-secondary:hover {
    background-color: #4a4a4a;
}

body.night-mode input,
body.night-mode textarea,
body.night-mode select {
    background-color: #2a2a2a;
    color: #ffffff;
    border-color: #4a4a4a;
}

body.night-mode .legal-footer {
    background-color: #1e1e1e;
    border-top: 1px solid #4a4a4a;
    color: #e0e0e0;
}

body.night-mode .data-table th {
    background-color: #2a2a2a;
    color: #ffffff;
}

body.night-mode .data-table td {
    border-color: #4a4a4a;
    color: #ffffff;
}

body.night-mode .module-selector,
body.night-mode .module-info-card {
    background-color: #1e1e1e;
    border-color: #4a4a4a;
}

/* Night mode text contrast improvements */
body.night-mode p,
body.night-mode .module-card p {
    color: #e0e0e0;
}

body.night-mode h1,
body.night-mode h2,
body.night-mode h3,
body.night-mode h4,
body.night-mode h5,
body.night-mode h6 {
    color: #ffffff !important;
}

body.night-mode .module-card h3 {
    color: #ffffff !important;
}

body.night-mode .page-header h1 {
    color: #ffffff !important;
}

body.night-mode .content-header h4 {
    color: #ffffff !important;
}

body.night-mode .content-body {
    background-color: #1e1e1e;
}

body.night-mode .table-container {
    background-color: #1e1e1e;
}

body.night-mode .cta-banner h3 {
    color: #ffffff !important;
}


body.night-mode .module-card {
    background: linear-gradient(150deg, rgba(38, 38, 46, 0.92), rgba(24, 24, 32, 0.96));
    border-color: rgba(219, 138, 112, 0.28);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
}

body.night-mode .module-card::before {
    background: linear-gradient(135deg, rgba(219, 138, 112, 0.18), rgba(255, 255, 255, 0));
    opacity: 0.45;
}

body.night-mode .module-card::after {
    background: radial-gradient(circle at 18% 18%, rgba(219, 138, 112, 0.28), transparent 55%);
    opacity: 0.55;
}

body.night-mode .module-card p {
    color: rgba(235, 235, 235, 0.72);
}

body.night-mode .progress-bar {
    background: rgba(219, 138, 112, 0.25);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

body.night-mode .content-section {
    background: linear-gradient(155deg, rgba(32, 32, 36, 0.92), rgba(24, 24, 30, 0.96));
    border-color: rgba(219, 138, 112, 0.28);
    box-shadow: 0 34px 80px rgba(0, 0, 0, 0.55);
}

body.night-mode .content-section::before {
    background: radial-gradient(circle at 12% 0%, rgba(219, 138, 112, 0.32), transparent 60%);
    opacity: 0.6;
}

body.night-mode .content-header {
    background: linear-gradient(120deg, rgba(42, 42, 48, 0.9), rgba(34, 34, 40, 0.92));
}

body.night-mode .content-header .toggle-icon {
    background: rgba(219, 138, 112, 0.25);
    color: rgba(255, 255, 255, 0.85);
}

body.night-mode .content-header:hover .toggle-icon {
    background: rgba(219, 138, 112, 0.35);
    color: #ffffff;
}

body.night-mode .content-body {
    background: linear-gradient(160deg, rgba(34, 34, 40, 0.92), rgba(24, 24, 30, 0.94));
    color: rgba(235, 235, 235, 0.82);
    border-color: rgba(219, 138, 112, 0.28);
    box-shadow: inset 0 1px 0 rgba(219, 138, 112, 0.15);
}

body.night-mode .content-body a {
    color: rgba(255, 180, 150, 0.95);
}

body.night-mode .content-body blockquote {
    border-left-color: rgba(219, 138, 112, 0.6);
    background: rgba(219, 138, 112, 0.12);
    color: rgba(245, 245, 245, 0.78);
}

body.night-mode .content-body code {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 239, 231, 0.92);
}

/* Star Rating */
.star {
    color: #ddd;
    transition: color 0.2s;
}

.star:hover,
.star.active {
    color: #ffd700;
}

/* ===========================================
   MOBILE & IFRAME CRITICAL FIXES
   =========================================== */

/* 
 * THE FIX: Make the entire page scrollable by swiping anywhere
 * Problem was: body/html had overflow issues, content was too wide
 * Solution: Constrain ALL content to viewport width, scroll on html
 */

/* Base mobile scroll - applies to all screen sizes when embedded */
html {
    overflow-x: hidden !important;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100vw;
}

body {
    overflow-x: hidden !important;
    overflow-y: visible !important;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Constrain ALL content to prevent horizontal overflow */
.dashboard,
.main-content,
.content-scaffold,
.content-primary,
.modules-grid,
.module-card,
.content-section,
.page-header,
.cta-banner,
.module-shell,
.module-main,
.module-navigator {
    max-width: 100%;
    box-sizing: border-box;
}

/* Ensure scrolling works on all mobile devices */
@media (max-width: 968px) {
    html {
        height: auto;
    }
    
    body {
        height: auto;
        position: relative;
    }
    
    /* Dashboard fills screen, no fixed positioning */
    .dashboard {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        width: 100%;
        overflow: visible;
    }
    
    /* Main content takes full width, no margin */
    .main-content {
        flex: 1;
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px 15px;
        overflow: visible;
    }
    
    .content-scaffold {
        width: 100%;
        overflow: visible;
    }
    
    /* Sidebar as overlay - hidden by default */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100%;
        z-index: 1010;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    
    /* Content areas - no overflow restrictions */
    .module-content-area,
    .content-section,
    .content-body {
        overflow: visible;
        width: 100%;
        max-width: 100%;
    }
    
    /* Module grid - single column on mobile */
    .modules-grid {
        grid-template-columns: 1fr;
        width: 100%;
        padding: 0;
    }
    
    /* Cards - constrained width */
    .module-card {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
    
    /* Footer positioning - NOT STICKY on mobile */
    .legal-footer {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
        position: static !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: auto !important;
    }
    
    /* Module view layout fix */
    .module-shell {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        padding: 15px;
    }
    
    .module-main {
        width: 100%;
        max-width: 100%;
    }
    
    .module-navigator {
        width: 100%;
        max-width: 100%;
        position: relative;
        top: auto;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .main-content {
        padding: 15px 12px;
    }
    
    .page-header {
        margin-bottom: 20px;
    }
    
    .page-header h1 {
        font-size: 22px;
    }
    
    .modules-grid {
        gap: 16px;
    }
    
    .module-card {
        padding: 20px;
    }
    
    .module-card h3 {
        font-size: 18px;
    }
    
    .cta-banner {
        padding: 20px 15px;
    }
    
    .cta-banner h3 {
        font-size: 18px;
    }
    
    /* Better touch targets */
    .btn {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .btn-sm {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    html, body {
        height: -webkit-fill-available;
    }
    
    .dashboard {
        min-height: -webkit-fill-available;
    }
    
    .main-content {
        min-height: auto;
    }
}

/* Iframe embed specific */
body.in-iframe {
    min-height: auto;
}

body.in-iframe .dashboard {
    min-height: auto;
}

body.in-iframe .legal-footer {
    position: relative;
    margin-top: auto;
}

/* Loading overlay improvements */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(145deg, #ffffff 0%, #fdf9f7 50%, #faf5f2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* Better loading text */
.loading-text {
    margin-top: 28px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
}

.loading-subtext {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-light);
    text-align: center;
    max-width: 280px;
}

/* Loading progress indicator */
.loading-progress {
    margin-top: 20px;
    width: 200px;
    height: 4px;
    background: rgba(219, 138, 112, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    border-radius: 2px;
    animation: loadingProgress 1.5s ease-in-out infinite;
}

@keyframes loadingProgress {
    0% { transform: translateX(-100%); width: 30%; }
    50% { width: 60%; }
    100% { transform: translateX(400%); width: 30%; }
}

