/* ==========================================================================
   أرباحي — Public CMS Page Template (Task ID: V2-A — SUBTASK 2)
   --------------------------------------------------------------------------
   Styles all database-driven public pages (about, contact, privacy, terms,
   faq, how-it-works, cookie-policy, earnings-disclosure, refund-policy,
   anti-fraud, responsible-disclosure). These are rendered by
   /templates/page_template.php.

   Design goals (matches the homepage's dark-purple glass aesthetic):
     • Dark #0a0a14 background with subtle radial-glow orbs (decorative)
     • Glass card (backdrop-filter: blur(12px)) for the page body
     • Gradient page-hero title (#6c5ce7 → #a29bfe)
     • Glass-pill breadcrumb
     • Clean typography for the rich-text body content that comes from
       the database (h2/h3, p, ul/ol, strong, a, blockquote, code, pre,
       table, img) — so legacy editor HTML looks modern.
     • Mobile-responsive: tighter padding, smaller fonts.

   Design system (matches worklog.md):
     • Primary: #6c5ce7  ·  Primary light: #a29bfe
     • Dark: #0a0a14  ·  Card: #13131f
     • Text 1: #f5f5fa  ·  Text 2: #b8b8c8
     • Border: rgba(255,255,255,0.08)
     • Glass: backdrop-filter: blur(12px); background: rgba(19,19,31,0.6)
     • Cairo / Tajawal font stack
   ========================================================================== */

/* ==========================================================================
   1. PAGE WRAPPER — full-bleed dark background with decorative orbs
   ========================================================================== */
.page-content-wrapper {
    background: #0a0a14;
    min-height: calc(100vh - 60px);
    padding-top: 80px;
    padding-bottom: 80px;
    position: relative;
    overflow: hidden;
    font-family: "Cairo", "Tajawal", "Inter", -apple-system, BlinkMacSystemFont,
        "Segoe UI", system-ui, sans-serif;
    color: #b8b8c8;
}

/* Decorative gradient orbs — pure CSS, no JS. Same aesthetic as the
   homepage hero. Pointer-events: none so they never block clicks. */
.page-content-wrapper::before,
.page-content-wrapper::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
    -webkit-filter: blur(80px);
    opacity: 0.55;
}
.page-content-wrapper::before {
    width: 460px;
    height: 460px;
    top: -120px;
    inset-inline-end: -120px;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.30), transparent 70%);
}
.page-content-wrapper::after {
    width: 520px;
    height: 520px;
    bottom: -160px;
    inset-inline-start: -160px;
    background: radial-gradient(circle, rgba(162, 155, 254, 0.18), transparent 70%);
}

/* ==========================================================================
   2. GLASS CARD — the inner container that holds the page content
   ========================================================================== */
.page-content-inner {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 32px;
    background: rgba(19, 19, 31, 0.6);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   3. PAGE HEADER — hero title + breadcrumb + back-to-home pill
   ========================================================================== */
.page-content-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.page-hero-title {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.2;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #a29bfe; /* fallback */
    margin: 0 0 16px 0;
    text-align: center;
    letter-spacing: -0.01em;
}

.page-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 0.85rem;
    color: #b8b8c8;
}
.page-breadcrumb a {
    padding: 6px 14px;
    background: rgba(108, 92, 231, 0.08);
    border: 1px solid rgba(108, 92, 231, 0.18);
    border-radius: 8px;
    color: #b8b8c8;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.page-breadcrumb a:hover {
    background: rgba(108, 92, 231, 0.18);
    color: #a29bfe;
    border-color: rgba(108, 92, 231, 0.35);
}
.page-breadcrumb .breadcrumb-sep {
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.7rem;
}
.page-breadcrumb > span:last-child {
    padding: 6px 14px;
    background: rgba(162, 155, 254, 0.10);
    border: 1px solid rgba(162, 155, 254, 0.22);
    border-radius: 8px;
    color: #f5f5fa;
    font-weight: 700;
}

/* Back-to-home pill button (rendered by page_template.php) */
.page-back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    padding: 10px 22px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: #fff !important;
    border-radius: 999px;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 0.88rem;
    box-shadow: 0 8px 22px -6px rgba(108, 92, 231, 0.6);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.page-back-home:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -6px rgba(108, 92, 231, 0.8);
    color: #fff !important;
}
.page-back-home:active { transform: translateY(0) scale(0.97); }
.page-back-home i {
    font-size: 0.78rem;
    /* RTL-aware: in RTL the arrow points right-to-left → flip */
}
[dir="rtl"] .page-back-home i { transform: scaleX(-1); }

/* ==========================================================================
   4. PAGE BODY CONTENT — typography for the database rich-text
   --------------------------------------------------------------------------
   The body content comes from $pageContent which may include raw HTML from
   the old editor. These rules normalize everything to the dark glass theme.
   ========================================================================== */
.page-body-content {
    color: #b8b8c8;
    font-size: 1rem;
    line-height: 1.9;
}
.page-body-content > *:first-child { margin-top: 0; }
.page-body-content > *:last-child  { margin-bottom: 0; }

/* Headings */
.page-body-content h1 {
    font-size: 1.9rem;
    font-weight: 800;
    color: #f5f5fa;
    margin: 32px 0 16px;
    line-height: 1.3;
}
.page-body-content h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #f5f5fa;
    margin: 32px 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(108, 92, 231, 0.2);
    line-height: 1.35;
}
.page-body-content h2:first-child { margin-top: 0; }
.page-body-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #a29bfe;
    margin: 24px 0 12px;
    line-height: 1.4;
}
.page-body-content h4 {
    font-size: 1.08rem;
    font-weight: 700;
    color: #f5f5fa;
    margin: 20px 0 10px;
}
.page-body-content h5,
.page-body-content h6 {
    font-size: 0.98rem;
    font-weight: 700;
    color: #d8d8e8;
    margin: 18px 0 8px;
}

/* Paragraphs */
.page-body-content p {
    color: #b8b8c8;
    line-height: 1.9;
    font-size: 1rem;
    margin-bottom: 16px;
}

/* Lists */
.page-body-content ul,
.page-body-content ol {
    color: #b8b8c8;
    line-height: 2;
    padding-inline-start: 24px;
    margin-bottom: 16px;
}
.page-body-content li { margin-bottom: 8px; }
.page-body-content ul li::marker { color: #a29bfe; }
.page-body-content ol li::marker { color: #a29bfe; font-weight: 700; }

/* Definition lists */
.page-body-content dl { margin: 16px 0; }
.page-body-content dt {
    font-weight: 700;
    color: #f5f5fa;
    margin-top: 10px;
}
.page-body-content dd {
    color: #b8b8c8;
    margin-inline-start: 20px;
    margin-bottom: 8px;
}

/* Inline emphasis */
.page-body-content strong,
.page-body-content b {
    color: #f5f5fa;
    font-weight: 700;
}
.page-body-content em,
.page-body-content i { color: #d8d8e8; font-style: italic; }
.page-body-content u { text-decoration-color: #a29bfe; text-underline-offset: 3px; }

/* Links */
.page-body-content a {
    color: #a29bfe;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
    transition: color 0.25s ease;
}
.page-body-content a:hover { color: #6c5ce7; }

/* Blockquote */
.page-body-content blockquote {
    border-inline-start: 4px solid #6c5ce7;
    padding: 16px 20px;
    background: rgba(108, 92, 231, 0.06);
    border-radius: 0 12px 12px 0;
    margin: 20px 0;
    color: #d8d8e8;
    font-style: italic;
    line-height: 1.8;
}
[dir="rtl"] .page-body-content blockquote {
    border-radius: 12px 0 0 12px;
}

/* Inline code */
.page-body-content code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: "Courier New", "Cascadia Code", monospace;
    color: #00cec9;
    font-size: 0.92em;
    direction: ltr;
    unicode-bidi: embed;
}

/* Pre-formatted code blocks */
.page-body-content pre {
    background: #0d0d18;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin: 20px 0;
    direction: ltr;
    text-align: left;
}
.page-body-content pre code {
    background: transparent;
    padding: 0;
    color: #d8d8e8;
    font-size: 0.88rem;
}

/* Tables */
.page-body-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    font-size: 0.95rem;
}
.page-body-content thead th {
    background: rgba(108, 92, 231, 0.15);
    color: #f5f5fa;
    font-weight: 700;
    padding: 12px 16px;
    text-align: start;
    border-bottom: 1px solid rgba(108, 92, 231, 0.25);
}
.page-body-content tbody td {
    padding: 12px 16px;
    color: #b8b8c8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.page-body-content tbody tr:last-child td { border-bottom: none; }
.page-body-content tbody tr:hover td { background: rgba(108, 92, 231, 0.04); }

/* Images */
.page-body-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.page-body-content figure {
    margin: 24px 0;
    text-align: center;
}
.page-body-content figcaption {
    color: #8a8a9a;
    font-size: 0.85rem;
    margin-top: 8px;
    font-style: italic;
}

/* Horizontal rules — subtle divider */
.page-body-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.35), transparent);
    margin: 32px 0;
}

/* Iframes (embedded videos etc.) — keep them responsive */
.page-body-content iframe {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin: 20px 0;
}

/* ==========================================================================
   4b. FORMS — V2 added so contact forms (and any other forms embedded in
       CMS page content) inherit the dark glass theme. Without these rules,
       form inputs would use the browser's default white background + black
       text, which clashes badly with the dark theme.
   ========================================================================== */
.page-body-content form {
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.page-body-content label {
    display: block;
    color: #f5f5fa;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
}
.page-body-content input[type="text"],
.page-body-content input[type="email"],
.page-body-content input[type="password"],
.page-body-content input[type="number"],
.page-body-content input[type="tel"],
.page-body-content input[type="url"],
.page-body-content input[type="search"],
.page-body-content select,
.page-body-content textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #f5f5fa;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    box-sizing: border-box;
}
.page-body-content input:focus,
.page-body-content select:focus,
.page-body-content textarea:focus {
    outline: none;
    border-color: rgba(108, 92, 231, 0.55);
    background: rgba(108, 92, 231, 0.06);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}
.page-body-content input::placeholder,
.page-body-content textarea::placeholder {
    color: rgba(184, 184, 200, 0.5);
}
.page-body-content textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.7;
}
.page-body-content select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a29bfe' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 14px center;
    background-size: 18px;
    padding-left: 42px;
    cursor: pointer;
}
[dir="rtl"] .page-body-content select {
    background-position: right 14px center;
    padding-left: 16px;
    padding-right: 42px;
}
.page-body-content button,
.page-body-content input[type="submit"],
.page-body-content input[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    text-decoration: none;
    align-self: flex-start;
}
.page-body-content button:hover,
.page-body-content input[type="submit"]:hover,
.page-body-content input[type="button"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px -6px rgba(108, 92, 231, 0.7);
}
.page-body-content button:active,
.page-body-content input[type="submit"]:active,
.page-body-content input[type="button"]:active {
    transform: translateY(0) scale(0.98);
}
.page-body-content input[type="reset"] {
    background: rgba(255, 255, 255, 0.06);
    color: #b8b8c8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.page-body-content input[type="checkbox"],
.page-body-content input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #6c5ce7;
    cursor: pointer;
    vertical-align: middle;
}
.page-body-content fieldset {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
}
.page-body-content legend {
    color: #a29bfe;
    font-weight: 700;
    padding: 0 12px;
    font-size: 0.95rem;
}
.page-body-content .form-group,
.page-body-content .form-row,
.page-body-content .mb-3 {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}
.page-body-content .alert,
.page-body-content .notice,
.page-body-content .message {
    padding: 14px 18px;
    border-radius: 10px;
    margin: 16px 0;
    font-size: 0.9rem;
    line-height: 1.6;
}
.page-body-content .alert-success,
.page-body-content .success {
    background: rgba(0, 184, 148, 0.1);
    border: 1px solid rgba(0, 184, 148, 0.3);
    color: #00b894;
}
.page-body-content .alert-error,
.page-body-content .alert-danger,
.page-body-content .error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}
.page-body-content .alert-info,
.page-body-content .info {
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.3);
    color: #a29bfe;
}

/* ==========================================================================
   5. RESPONSIVE — tighten padding/font on small screens
   ========================================================================== */
@media (max-width: 768px) {
    .page-content-wrapper {
        padding-top: 70px;
        padding-bottom: 90px; /* clears the mobile bottom-nav bar */
    }
    .page-content-inner {
        padding: 28px 18px;
        border-radius: 16px;
    }
    .page-content-header { margin-bottom: 28px; padding-bottom: 20px; }
    .page-hero-title { font-size: clamp(1.6rem, 6vw, 2rem); }
    .page-breadcrumb { font-size: 0.78rem; }
    .page-breadcrumb a,
    .page-breadcrumb > span:last-child { padding: 5px 10px; }
    .page-back-home { padding: 9px 18px; font-size: 0.82rem; }

    .page-body-content { font-size: 0.95rem; line-height: 1.85; }
    .page-body-content h1 { font-size: 1.5rem; }
    .page-body-content h2 { font-size: 1.35rem; margin: 24px 0 14px; }
    .page-body-content h3 { font-size: 1.12rem; }
    .page-body-content pre { padding: 14px; font-size: 0.82rem; }
    .page-body-content table { font-size: 0.85rem; }
    .page-body-content thead th,
    .page-body-content tbody td { padding: 9px 10px; }
}

@media (max-width: 360px) {
    .page-content-inner { padding: 22px 12px; }
    .page-body-content { font-size: 0.9rem; }
    .page-body-content h2 { font-size: 1.2rem; }
    .page-body-content h3 { font-size: 1.05rem; }
}

/* ==========================================================================
   6. ACCESSIBILITY — respect reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .page-back-home,
    .page-breadcrumb a,
    .page-body-content a {
        transition: none;
    }
}
