/* ═══════════════════════════════════════════════════════════════════════════
   Quran Word-by-Word — Frontend Styles (Guardian Red Theme)
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Noto+Naskh+Arabic:wght@400;700&family=IBM+Plex+Sans+Thai+Looped:wght@300;400;500;600;700&display=swap');

/* Tarteel AI Surah Name Font v4 - Local Files */
@font-face {
  font-family: 'SurahNames';
  src: url('/wp-content/plugins/quranwordnew/assets/fonts/surah-name-v4.woff2') format('woff2'),
       url('/wp-content/plugins/quranwordnew/assets/fonts/surah-name-v4.woff') format('woff'),
       url('/wp-content/plugins/quranwordnew/assets/fonts/surah-name-v4.ttf') format('truetype');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}

/* Fallback font declaration */
@font-face {
  font-family: 'surah-name-v4-icon';
  src: url('/wp-content/plugins/quranwordnew/assets/fonts/surah-name-v4.woff2') format('woff2'),
       url('/wp-content/plugins/quranwordnew/assets/fonts/surah-name-v4.woff') format('woff'),
       url('/wp-content/plugins/quranwordnew/assets/fonts/surah-name-v4.ttf') format('truetype');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
    --stq-primary: #9b2c2c; /* elegant crimson red */
    --stq-primary-dark: #742a2a;
    --stq-primary-light: #fef2f2;
    --stq-gold: #b7791f; /* gold for subtle accents */
    --stq-gold-light: #fdfaf6;
    --stq-bg: #faf9f6; /* warm off-white, ivory */
    --stq-gray-50: #ffffff;
    --stq-gray-100: #fcfbf8;
    --stq-gray-200: #eadecd; /* warm subtle line */
    --stq-gray-500: #71695a;
    --stq-gray-700: #4a4031;
    --stq-gray-800: #2d241c;
    --stq-radius: 16px;
    --stq-radius-sm: 8px;
    --stq-shadow: 0 4px 20px -5px rgba(116, 42, 42, 0.05);
    --stq-shadow-hover: 0 10px 30px -5px rgba(116, 42, 42, 0.1);
    --stq-shadow-soft: 0 14px 40px -22px rgba(0, 0, 0, 0.22);
    --stq-ring: 0 0 0 4px rgba(155, 44, 44, 0.18);
    --stq-font-thai: 'IBM Plex Sans Thai Looped', 'Sarabun', 'Tahoma', 'Arial', sans-serif;
    --stq-font-arabic: 'Noto Naskh Arabic', 'Amiri', 'KFGQPC Uthman Taha Naskh', 'Scheherazade New', 'Lateef', 'Traditional Arabic', 'Arial', serif;
    --stq-font-surah-name: 'Noto Naskh Arabic', 'Amiri', 'KFGQPC Uthman Taha Naskh', 'Scheherazade New', 'Lateef', 'Traditional Arabic', 'Arial', serif;
}

/* ── Accessibility & Motion ─────────────────────────────────────────────── */
.stq-portal-card:focus-visible,
.stq-nav-btn:focus-visible,
.stq-action-btn:focus-visible,
.stq-page-btn:focus-visible,
.stq-portal-search input:focus-visible {
    outline: none;
    box-shadow: var(--stq-ring);
}

@media (prefers-reduced-motion: reduce) {
    .stq-portal-card,
    .stq-ayah-card,
    .stq-page-btn,
    .stq-nav-btn,
    .stq-action-btn {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
}

/* ── Container ─────────────────────────────────────────────────────────── */
.stq-surah-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0 40px;
    font-family: var(--stq-font-thai);
    background: transparent;
    border-radius: 0;
    border: none;
}

/* ── Surah Header ──────────────────────────────────────────────────────── */
/* Islamic Minimal Colorful Modern Surah Header */
.stq-surah-header {
    background: linear-gradient(135deg, 
        #f8f4ef 0%, 
        #f5ebe0 25%,
        #e8f4f8 50%,
        #f0e8d8 75%,
        #f5ebe0 100%
    );
    color: #4a4035;
    border-radius: 24px;
    padding: 50px 30px;
    text-align: center;
    position: relative;
    box-shadow: 
        0 4px 24px rgba(139, 92, 68, 0.08),
        0 24px 80px -20px rgba(139, 92, 68, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: none;
    margin-bottom: 40px;
    overflow: hidden;
}

/* Islamic Geometric Pattern Overlay */
.stq-surah-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 15% 85%, rgba(212, 175, 130, 0.12) 0%, transparent 35%),
        radial-gradient(circle at 85% 15%, rgba(72, 149, 139, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 50% 50%, rgba(183, 121, 31, 0.06) 0%, transparent 25%);
    pointer-events: none;
}

/* Decorative Corner Ornaments */
.stq-surah-header::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, 
        rgba(212, 175, 130, 0.15) 0%,
        transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
}

/* Additional decorative element */
.stq-surah-header .header-ornament {
    position: absolute;
    bottom: -40px;
    left: -40px;
    width: 150px;
    height: 150px;
    background: linear-gradient(315deg, 
        rgba(72, 149, 139, 0.12) 0%,
        transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
}

/* top row: arabic name + nav buttons */
.stq-surah-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.stq-surah-name-ar {
    font-family: var(--stq-font-surah-name);
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    direction: rtl;
    line-height: 1.4;
    letter-spacing: 0.02em;
    font-variant-ligatures: common-ligatures;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: "liga", "dlig";
    font-feature-settings: "liga", "dlig";
    color: #4a4035;
    text-shadow: 0 2px 20px rgba(74, 64, 53, 0.08);
}

.stq-surah-nav {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.stq-nav-btn {
    background: rgba(255, 255, 255, 0.7);
    color: #6b5d4d;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.85rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(212, 175, 130, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(139, 92, 68, 0.06);
}

.stq-nav-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    color: #4a4035;
    border-color: #d4af82;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(212, 175, 130, 0.2);
}

/* bottom row: thai name + meta */
.stq-surah-row-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.9rem;
    color: #8b7355;
    flex-wrap: wrap;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

.stq-surah-name-th {
    color: #6b5d4d;
    font-weight: 600;
    font-size: 1rem;
}

.stq-surah-sep {
    color: #d4af82;
    opacity: 0.5;
    font-size: 0.8rem;
}

/* ── Surah Intro Description ─────────────────────────────────────────────── */
.stq-surah-intro {
    background: white;
    border-radius: var(--stq-radius);
    padding: 22px 26px;
    margin-bottom: 20px;
    border: 1px solid var(--stq-gray-200);
    box-shadow: var(--stq-shadow);
    color: var(--stq-gray-700);
    font-size: 0.95rem;
    line-height: 1.85;
}

.stq-surah-intro p {
    margin: 0 0 10px 0;
}

.stq-surah-intro p:last-child {
    margin-bottom: 0;
}

/* ── Bismillah ─────────────────────────────────────────────────────────── */
.stq-bismillah {
    text-align: center;
    font-family: var(--stq-font-arabic);
    font-size: 2.2rem;
    color: var(--stq-primary-dark);
    padding: 24px;
    margin-bottom: 24px;
    direction: rtl;
    opacity: 0.85;
    letter-spacing: 0.03em;
}

/* ── Ayah Card (Modern Bubble) ──────────────────────────────────────────── */
.stq-ayahs {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.stq-ayah-card {
    --stq-bubble-radius: 28px;
    --stq-bubble-radius-sm: 16px;
    background: linear-gradient(165deg,
        rgba(255, 255, 255, 0.95) 0%,
        var(--ac-light, rgba(255, 255, 255, 0.85)) 45%,
        rgba(255, 255, 255, 0.92) 100%);
    border-radius: var(--stq-bubble-radius);
    border: 1px solid rgba(255, 255, 255, 0.9);
    padding: 0;
    box-shadow:
        0 8px 32px -8px rgba(0, 0, 0, 0.08),
        0 4px 16px -4px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: stqCardEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0s;
    opacity: 0;
    position: relative;
    margin-top: 32px;
    isolation: isolate;
    overflow: visible;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.stq-ayah-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--ac-color, var(--stq-gold)) 0%, transparent 60%, rgba(255,255,255,0.8) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.5;
}

.stq-ayah-card:hover {
    box-shadow:
        0 20px 60px -16px rgba(0, 0, 0, 0.15),
        0 12px 32px -8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5),
        0 0 0 4px var(--ac-subtle, rgba(183, 121, 31, 0.1)),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-6px) scale(1.02);
    border-color: rgba(255, 255, 255, 1);
}

.stq-ayah-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background:
        radial-gradient(600px 180px at 10% 0%, var(--ac-subtle, rgba(183, 121, 31, 0.12)), transparent 50%),
        radial-gradient(400px 150px at 100% 100%, rgba(255, 255, 255, 0.95), transparent 60%);
    opacity: 0.8;
    z-index: -1;
}

/* ── Section 1: Ayah Head (number badge bubble) ──────────────────────────── */
.stq-ayah-head {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 8px;
    margin-bottom: 8px;
}

.stq-ayah-badge {
    position: absolute;
    top: -26px;
    left: 50%;
    transform: translateX(-50%);
    width: 52px;
    height: 52px;
    background: var(--ac-bg, var(--stq-gray-50));
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 800;
    box-shadow:
        0 6px 20px -4px rgba(0, 0, 0, 0.2),
        0 0 0 4px rgba(255, 255, 255, 0.95),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.9);
    font-family: var(--stq-font-arabic);
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Section 2: Arabic verse (bubble block) ─────────────────────────────── */
.stq-ayah-arabic {
    font-family: var(--stq-font-arabic);
    font-size: 2.2rem;
    line-height: 2.4;
    color: var(--stq-gray-800);
    text-align: right;
    padding: 20px 24px 16px;
    margin: 0 16px 12px;
    cursor: default;
    letter-spacing: 0.01em;
    text-wrap: pretty;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, var(--ac-light, rgba(255, 255, 255, 0.7)) 100%);
    border-radius: var(--stq-bubble-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* ── Quran Tajweed colors (inside .stq-ayah-arabic) ─────────────────────── */
/* Gray: silent / hamzat wasl / lam shamsiyyah */
.stq-ayah-arabic .stq-tj-ham_wasl,
.stq-ayah-arabic .stq-tj-slnt,
.stq-ayah-arabic .stq-tj-laam_shamsiyah { color: #6b7280; }
.stq-ayah-arabic .stq-tj-end { 
    color: var(--stq-gray-500); 
    font-weight: 600; 
    position: relative;
    margin-left: 8px;
}

/* Quran End Symbol (Ayah Marker) */
.stq-ayah-arabic .stq-tj-end::after {
    content: '۝';
    font-family: var(--stq-font-arabic);
    font-size: 1.1em;
    color: var(--stq-gold);
    margin-right: 4px;
    vertical-align: middle;
    opacity: 0.9;
}
/* Quran End Symbol (Ayah Marker) - Direct span element */
.stq-end-symbol {
    font-family: var(--stq-font-arabic);
    font-size: 1.1em;
    color: var(--stq-gold);
    margin-right: 4px;
    margin-left: 8px;
    vertical-align: middle;
    opacity: 0.9;
    display: inline;
}

/* Madda: blues (แยกโทนให้ต่างจากตัวอื่น) */
.stq-ayah-arabic .stq-tj-madda_normal { color: #2563eb; }
.stq-ayah-arabic .stq-tj-madda_permissible { color: #1d4ed8; }
.stq-ayah-arabic .stq-tj-madda_necessary { color: #1e40af; }
.stq-ayah-arabic .stq-tj-madda_obligatory { color: #1e3a8a; }
/* Red / Orange / Purple / Green / Cyan */
.stq-ayah-arabic .stq-tj-qlq { color: #b91c1c; }
.stq-ayah-arabic .stq-tj-ghn { color: #c2410c; }
.stq-ayah-arabic .stq-tj-ikhf { color: #7e22ce; }
.stq-ayah-arabic .stq-tj-ikhf_shfw { color: #9333ea; }
.stq-ayah-arabic .stq-tj-idghm_shfw { color: #15803d; }
.stq-ayah-arabic .stq-tj-idgh_ghn { color: #0f766e; }
.stq-ayah-arabic .stq-tj-idgh_w_ghn { color: #166534; }
.stq-ayah-arabic .stq-tj-iqlb { color: #0e7490; }
/* ตัวที่ไม่มีกฎ: ใช้สีดำ/เทาเข้ม (ไม่ให้ไปรวมกับน้ำเงิน) */
.stq-ayah-arabic .stq-tj-default { color: var(--stq-gray-800); }
/* Segment cycle (fallback) */
.stq-ayah-arabic .stq-tj-s1 { color: #0d9488; }
.stq-ayah-arabic .stq-tj-s2 { color: #2563eb; }
.stq-ayah-arabic .stq-tj-s3 { color: #7c3aed; }
.stq-ayah-arabic .stq-tj-s4 { color: #dc2626; }
.stq-ayah-arabic .stq-tj-s5 { color: #ea580c; }
.stq-ayah-arabic .stq-tj-s6 { color: #0891b2; }

/* ── Section 3: Word-by-word (bubble container + word pills) ─────────────── */
.stq-words-row {
    display: flex;
    flex-wrap: wrap;
    direction: rtl;
    gap: 8px;
    padding: 16px 20px 20px;
    margin: 0 12px 16px;
    justify-content: flex-start;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, var(--ac-light, rgba(255, 255, 255, 0.6)) 100%);
    border-radius: var(--stq-bubble-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* ── Section 4: Translation + actions (footer bubble band) ────────────────── */
.stq-ayah-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 24px 24px;
    margin: 0;
    background: linear-gradient(180deg, var(--ac-light, rgba(255, 255, 255, 0.9)) 0%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: 0 0 calc(var(--stq-bubble-radius) - 2px) calc(var(--stq-bubble-radius) - 2px);
    border-top: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 -2px 12px -4px rgba(0, 0, 0, 0.04);
}

.stq-ayah-thai {
    color: var(--stq-gray-800);
    font-size: 1.1rem;
    line-height: 1.85;
    flex: 1 1 100%;
    text-wrap: pretty;
    padding-right: 8px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ── Footnote ───────────────────────────────────────────────────────────── */
.stq-ayah-footnote {
    color: var(--stq-gray-500);
    font-size: 0.9rem;
    line-height: 1.7;
    flex: 1 1 100%;
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(183, 121, 31, 0.06);
    border-left: 3px solid var(--stq-gold);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.stq-footnote-icon {
    color: var(--stq-gold);
    font-weight: 700;
    margin-right: 6px;
}

.stq-ayah-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.stq-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    padding: 10px 16px;
    font-size: 0.8rem;
    font-family: var(--stq-font-thai);
    color: var(--ac-color, var(--stq-gray-600));
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-weight: 600;
}

.stq-action-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.95) 100%);
    color: var(--ac-color, var(--stq-primary));
    border-color: var(--ac-color, rgba(255, 255, 255, 0.95));
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stq-action-btn:active {
    transform: translateY(1px);
}

.stq-action-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* ── Word pills (bubbles inside words row) ──────────────────────────────── */
.stq-word-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    padding: 12px 16px;
    text-align: center;
    cursor: default;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 75px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.stq-word-card::after {
    display: none;
}

.stq-word-card:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.95) 100%);
    border-color: rgba(255, 255, 255, 1);
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stq-word-ar {
    font-family: var(--stq-font-arabic);
    font-size: 1.3rem;
    color: var(--stq-gray-800);
    direction: rtl;
    line-height: 1.5;
}

.stq-word-translit {
    font-size: 0.6rem;
    color: var(--stq-gray-500);
    margin-top: 3px;
    letter-spacing: 0.01em;
}

.stq-word-th {
    font-size: 0.7rem;
    color: var(--stq-primary-dark);
    font-weight: 600;
    margin-top: 5px;
    line-height: 1.3;
}

/* ── Tooltip ───────────────────────────────────────────────────────────── */
.stq-tooltip {
    position: fixed;
    z-index: 99999;
    background: #fff;
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.05);
    border: 1px solid var(--stq-gray-200);
    min-width: 170px;
    max-width: 260px;
    pointer-events: none;
    transition: opacity 0.12s;
}

.stq-tooltip-ar {
    font-family: var(--stq-font-arabic);
    font-size: 1.5rem;
    text-align: center;
    color: var(--stq-gray-800);
    direction: rtl;
    padding-bottom: 8px;
    border-bottom: 1px solid #f4f5f7;
    margin-bottom: 6px;
    line-height: 1.6;
}

.stq-tooltip-translit {
    font-size: 0.75rem;
    color: var(--stq-gray-500);
    text-align: center;
    font-style: italic;
}

.stq-tooltip-th {
    font-size: 0.9rem;
    color: var(--stq-primary-dark);
    font-weight: 700;
    text-align: center;
    margin-top: 5px;
}

.stq-tooltip-pos {
    font-size: 0.65rem;
    color: var(--stq-primary-dark);
    text-align: center;
    margin-top: 5px;
    background: var(--stq-primary-light);
    padding: 2px 10px;
    border-radius: 20px;
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    letter-spacing: 0.02em;
}

.stq-tooltip-pos:empty { display: none; }

/* ── Pagination ────────────────────────────────────────────────────────── */
.stq-pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin: 28px 0 8px;
    flex-wrap: wrap;
}

.stq-page-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--stq-gray-50);
    border: 1px solid var(--stq-gray-200);
    color: var(--stq-gray-500);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.stq-page-btn:hover {
    background: var(--stq-gold-light);
    color: var(--stq-primary-dark);
    border-color: var(--stq-gold);
}

.stq-page-active {
    background: var(--stq-gold) !important;
    color: white !important;
    border-color: var(--stq-gold) !important;
    box-shadow: 0 4px 12px rgba(183, 121, 31, 0.3);
}

.stq-page-dots {
    display: flex;
    align-items: center;
    color: var(--stq-gray-500);
    padding: 0 4px;
    font-size: 0.85rem;
}

/* ── Source ──────────────────────────────────────────────────────────────── */
.stq-source {
    text-align: center;
    font-size: 0.75rem;
    color: var(--stq-gray-500);
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid var(--stq-gray-100);
}

.stq-source a {
    color: var(--stq-primary);
    text-decoration: none;
}

.stq-source a:hover { text-decoration: underline; }

/* ── Error ──────────────────────────────────────────────────────────────── */
.stq-error {
    text-align: center;
    padding: 40px;
    color: var(--stq-gray-500);
    font-size: 1rem;
}

.stq-words-loading {
    text-align: center;
    padding: 16px;
    color: var(--stq-gray-500);
    font-size: 0.85rem;
}

/* ── Portal ────────────────────────────────────────────────────────────── */
.stq-portal-container {
    max-width: 1200px;
    margin: 0 auto;
    font-family: var(--stq-font-thai);
}

/* Islamic Minimal Colorful Modern Header */
.stq-portal-header {
    background: linear-gradient(135deg, 
        #f8f4ef 0%, 
        #f5ebe0 25%,
        #e8f4f8 50%,
        #f0e8d8 75%,
        #f5ebe0 100%
    );
    border: none;
    border-radius: 24px;
    padding: 80px 40px 70px;
    text-align: center;
    box-shadow: 
        0 4px 24px rgba(139, 92, 68, 0.08),
        0 24px 80px -20px rgba(139, 92, 68, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    margin-bottom: 50px;
    position: relative;
    overflow: hidden;
}

/* Islamic Geometric Pattern Overlay */
.stq-portal-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(212, 175, 130, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(72, 149, 139, 0.12) 0%, transparent 35%),
        radial-gradient(circle at 40% 40%, rgba(183, 121, 31, 0.08) 0%, transparent 30%);
    pointer-events: none;
}

/* Decorative Islamic Arch Shape */
.stq-portal-header::after {
    content: '';
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 120px;
    background: linear-gradient(180deg, 
        rgba(212, 175, 130, 0.2) 0%,
        rgba(212, 175, 130, 0.05) 60%,
        transparent 100%
    );
    border-radius: 0 0 100px 100px;
    pointer-events: none;
}

/* Floating Orbs - Islamic Inspired */
.stq-portal-header .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: orbFloat 20s ease-in-out infinite;
}

.stq-portal-header .orb-1 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #d4af82, #c4956a);
    top: -100px;
    right: -80px;
    animation-delay: 0s;
}

.stq-portal-header .orb-2 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #48958b, #5ba89e);
    bottom: -80px;
    left: -60px;
    animation-delay: -7s;
}

.stq-portal-header .orb-3 {
    width: 180px;
    height: 180px;
    background: linear-gradient(135deg, #b7791f, #d4a853);
    top: 50%;
    right: 15%;
    animation-delay: -14s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

@keyframes stqCardEntrance {
    0% { opacity: 0; transform: translateY(20px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.stq-portal-title {
    font-size: 2.8rem;
    color: #4a4035;
    margin: 0 0 12px 0;
    font-weight: 600;
    position: relative;
    z-index: 1;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 20px rgba(74, 64, 53, 0.08);
}

/* Arabic subtitle */
.stq-portal-subtitle {
    font-family: var(--stq-font-arabic);
    font-size: 1.6rem;
    color: #8b7355;
    margin-bottom: 28px;
    direction: rtl;
    opacity: 0.85;
    position: relative;
    z-index: 1;
}

.stq-portal-stats {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 0.95rem;
    color: #6b5d4d;
    background: rgba(255, 255, 255, 0.65);
    padding: 14px 28px;
    border-radius: 50px;
    margin-bottom: 36px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 130, 0.3);
    box-shadow: 
        0 4px 20px rgba(139, 92, 68, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

.stq-portal-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stq-portal-stats .stat-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #d4af82, #c4956a);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
}

.stq-portal-stats .stat-icon.teal {
    background: linear-gradient(135deg, #48958b, #5ba89e);
}

.stq-portal-stats strong {
    color: #4a4035;
    font-size: 1.1rem;
    font-weight: 600;
}

.stq-portal-stats .stq-dot-sep {
    color: #d4af82;
    opacity: 0.5;
}

.stq-portal-search {
    max-width: 520px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    z-index: 1;
}

.stq-portal-search input {
    width: 100%;
    padding: 18px 60px 18px 28px;
    border-radius: 50px;
    border: 1px solid rgba(212, 175, 130, 0.4);
    font-family: var(--stq-font-thai);
    font-size: 1.05rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(255, 255, 255, 0.85);
    color: #4a4035;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 
        0 4px 20px rgba(139, 92, 68, 0.06),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
}

.stq-portal-search input::placeholder {
    color: #a89a8a;
    font-weight: 400;
}

.stq-portal-search input:focus {
    outline: none;
    border-color: #d4af82;
    box-shadow: 
        0 0 0 4px rgba(212, 175, 130, 0.15),
        0 8px 32px rgba(139, 92, 68, 0.12);
    background: rgba(255, 255, 255, 0.95);
}

.stq-portal-search button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #d4af82, #c4956a);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(212, 175, 130, 0.4);
}

.stq-portal-search button:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(212, 175, 130, 0.5);
}

.stq-portal-search button svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

.stq-portal-section-title {
    font-size: 1.3rem;
    color: var(--stq-primary-dark);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--stq-gray-200);
    padding-bottom: 12px;
}

.stq-portal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.stq-dot-pub { background: var(--stq-gold); box-shadow: 0 0 8px rgba(183, 121, 31, 0.4); }
.stq-dot-draft { background: var(--stq-gray-500); }

.stq-portal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 1024px) {
    .stq-portal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stq-portal-grid {
        grid-template-columns: 1fr;
    }
}

.stq-portal-card {
    background: var(--stq-gray-50);
    border-radius: var(--stq-radius);
    padding: 16px 20px;
    text-decoration: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(234, 222, 205, 0.75);
    box-shadow: 0 10px 28px -20px rgba(0,0,0,0.22);
}

.stq-portal-card.published {
    border-top: 4px solid var(--pc-color, var(--stq-gold));
    box-shadow: var(--stq-shadow);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 6-Color Jewel & Pastel Palette for All Portal Cards */
.stq-portal-card:nth-child(6n + 1) { --pc-color: #10b981; --pc-bg: linear-gradient(135deg, #10b981, #047857); --pc-light: #ecfdf5; } /* Emerald */
.stq-portal-card:nth-child(6n + 2) { --pc-color: #3b82f6; --pc-bg: linear-gradient(135deg, #3b82f6, #1d4ed8); --pc-light: #eff6ff; } /* Azure */
.stq-portal-card:nth-child(6n + 3) { --pc-color: #8b5cf6; --pc-bg: linear-gradient(135deg, #8b5cf6, #6d28d9); --pc-light: #f5f3ff; } /* Amethyst */
.stq-portal-card:nth-child(6n + 4) { --pc-color: #f43f5e; --pc-bg: linear-gradient(135deg, #f43f5e, #be123c); --pc-light: #fff1f2; } /* Rose / Ruby */
.stq-portal-card:nth-child(6n + 5) { --pc-color: #f59e0b; --pc-bg: linear-gradient(135deg, #f59e0b, #b45309); --pc-light: #fffbeb; } /* Amber / Topaz */
.stq-portal-card:nth-child(6n + 6) { --pc-color: #0ea5e9; --pc-bg: linear-gradient(135deg, #0ea5e9, #0369a1); --pc-light: #f0f9ff; } /* Ocean / Sapphire */

.stq-portal-card.published {
    background: linear-gradient(135deg, var(--pc-light, #ffffff) 0%, #ffffff 60%);
}

.stq-portal-card.published::after {
    content: '';
    position: absolute;
    inset: -40% -35% auto auto;
    width: 220px;
    height: 220px;
    background: var(--pc-bg, linear-gradient(135deg, var(--stq-gold), var(--stq-primary)));
    opacity: 0.12;
    transform: rotate(18deg);
    filter: blur(0.2px);
    pointer-events: none;
}

.stq-portal-card.published:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.06);
    border-color: var(--pc-color);
}

.stq-portal-card.draft {
    background: var(--stq-bg);
    opacity: 0.65;
    filter: grayscale(1);
    cursor: default;
}

.stq-portal-card.draft:hover {
    filter: grayscale(0);
    opacity: 1;
    transform: translateY(-3px);
    box-shadow: 0 12px 25px -5px rgba(0,0,0,0.1);
    background: #ffffff;
}

.stq-portal-card.draft:hover .stq-pc-num {
    background: var(--pc-bg);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transform: scale(1.1) rotate(5deg);
}

.stq-pc-meta {
    flex: 0 0 auto;
}

.stq-pc-num {
    background: var(--pc-light);
    color: var(--pc-color);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 1rem;
    flex: 0 0 auto;
}

.stq-portal-card.published .stq-pc-num {
    background: var(--pc-bg);
    color: #ffffff;
    box-shadow: 0 12px 26px -18px rgba(0,0,0,0.55);
}

.stq-portal-card.published:hover .stq-pc-num {
    transform: scale(1.05);
}

.stq-portal-card.published .stq-pc-ar-title {
    color: var(--pc-color);
    opacity: 0.95;
}

.stq-portal-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(900px 240px at 0% 0%, rgba(255,255,255,0.8), transparent 55%),
        radial-gradient(700px 220px at 100% 20%, rgba(255,255,255,0.65), transparent 60%);
    opacity: 0.75;
}

@supports (color: color-mix(in srgb, red, white)) {
    .stq-portal-card.published:hover {
        border-color: color-mix(in srgb, var(--pc-color) 55%, rgba(234, 222, 205, 1));
    }

    .stq-portal-card::before {
        background:
            radial-gradient(900px 240px at 0% 0%, rgba(255,255,255,0.8), transparent 55%),
            radial-gradient(700px 220px at 100% 20%, color-mix(in srgb, var(--pc-light) 90%, white), transparent 60%);
    }
}

.stq-portal-card.published:hover .stq-pc-num {
    background: var(--pc-color);
    color: #ffffff;
    transform: scale(1.05);
}

.stq-pc-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.stq-pc-th-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--stq-gray-800);
    margin: 0;
}

.stq-pc-subtitle {
    font-size: 0.85rem;
    color: var(--stq-gray-500);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.stq-dot-sep {
    color: var(--stq-gray-200);
}

.stq-pc-ar-title {
    flex: 0 0 auto;
    font-family: var(--stq-font-surah-name);
    font-size: 1.2rem;
    color: var(--stq-gray-800);
    text-align: right;
    line-height: 1;
    font-variant-ligatures: common-ligatures;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: "liga", "dlig";
    font-feature-settings: "liga", "dlig";
}

.stq-status-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
}

/* For draft cards specifically */
.stq-portal-card.draft .stq-status-badge {
    position: static;
    opacity: 1;
    background: var(--stq-gray-200);
    color: var(--stq-gray-500);
}

.stq-portal-card.published:hover .stq-status-badge {
    opacity: 1;
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
    transform: translateY(18px);
}

/* ── Colorful Ayah Cards Override (bubble accent) ─────────────────────────── */
.stq-ayah-card:nth-child(6n + 1) { --ac-color: #00d084; --ac-bg: linear-gradient(135deg, #00d084, #00a86b); --ac-light: #e8fff3; --ac-subtle: rgba(0, 208, 132, 0.12); animation-delay: 0.05s; } 
.stq-ayah-card:nth-child(6n + 2) { --ac-color: #3b8bff; --ac-bg: linear-gradient(135deg, #3b8bff, #1d6eff); --ac-light: #ebf3ff; --ac-subtle: rgba(59, 139, 255, 0.12); animation-delay: 0.1s; } 
.stq-ayah-card:nth-child(6n + 3) { --ac-color: #9d5cff; --ac-bg: linear-gradient(135deg, #9d5cff, #7c3aed); --ac-light: #f5f0ff; --ac-subtle: rgba(157, 92, 255, 0.12); animation-delay: 0.15s; } 
.stq-ayah-card:nth-child(6n + 4) { --ac-color: #ff4757; --ac-bg: linear-gradient(135deg, #ff4757, #ff2e43); --ac-light: #ffecee; --ac-subtle: rgba(255, 71, 87, 0.12); animation-delay: 0.2s; } 
.stq-ayah-card:nth-child(6n + 5) { --ac-color: #ffa502; --ac-bg: linear-gradient(135deg, #ffa502, #e67e00); --ac-light: #fff5e6; --ac-subtle: rgba(255, 165, 2, 0.12); animation-delay: 0.25s; } 
.stq-ayah-card:nth-child(6n + 6) { --ac-color: #00b4ff; --ac-bg: linear-gradient(135deg, #00b4ff, #0095d6); --ac-light: #e6f7ff; --ac-subtle: rgba(0, 180, 255, 0.12); animation-delay: 0.3s; } 

.stq-ayah-card:hover {
    background: linear-gradient(165deg, rgba(255,255,255,0.98) 0%, var(--ac-subtle) 45%, rgba(255,255,255,0.95) 100%);
}

.stq-ayah-card:hover .stq-ayah-badge {
    transform: translateX(-50%) scale(1.12);
    box-shadow: 0 8px 24px -4px rgba(0,0,0,0.25), 0 0 0 4px rgba(255,255,255,0.95), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.stq-ayah-card .stq-word-card:hover {
    background: var(--ac-light);
    border-color: rgba(255, 255, 255, 1);
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ── Colorful Headers Override (Disabled for new Islamic design) ─────────── */
/*
.stq-surah-header, .stq-portal-header {
    background: linear-gradient(135deg, #1d4ed8, #8b5cf6, #f43f5e) !important;
    background-size: 200% 200% !important;
    animation: stqGradientAnimation 10s ease infinite !important;
    color: #ffffff !important;
    box-shadow: 0 12px 30px -10px rgba(139, 92, 246, 0.5) !important;
    border: none !important;
}
*/

/* Old overrides removed - now using Islamic Minimal design */

@keyframes stqGradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.stq-nav-home svg {
    display: inline-block;
    vertical-align: middle;
    margin-top: -1px;
    margin-right: 2px;
}

.stq-portal-title { color: #4a4035; }
.stq-portal-desc { color: #8b7355; }

/* ── Responsive ────────────────────────────────────────────────────────── */

/* Tablet responsive for portal header */
@media (max-width: 1024px) {
    .stq-portal-header {
        padding: 60px 30px 50px;
        margin-bottom: 40px;
    }
    
    .stq-portal-title {
        font-size: 2.2rem;
    }
    
    .stq-portal-subtitle {
        font-size: 1.4rem;
    }
    
    .stq-portal-stats {
        padding: 12px 24px;
        gap: 16px;
    }
    
    .stq-portal-header .orb-1 {
        width: 250px;
        height: 250px;
    }
    
    .stq-portal-header .orb-2 {
        width: 200px;
        height: 200px;
    }
}

/* Mobile responsive for portal and surah headers */
@media (max-width: 640px) {
    .stq-surah-container { padding: 16px 12px; }
    .stq-surah-header { 
        padding: 32px 16px; 
        border-radius: 20px;
    }
    .stq-surah-name-ar { font-size: 1.6rem; }
    .stq-surah-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
    .stq-nav-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    .stq-surah-row-bottom {
        font-size: 0.85rem;
        gap: 8px;
    }
    .stq-surah-header .header-ornament,
    .stq-surah-header::after {
        display: none;
    }
    .stq-ayah-card { margin-top: 24px; --stq-bubble-radius: 20px; --stq-bubble-radius-sm: 12px; animation: none; opacity: 1; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .stq-ayah-arabic { font-size: 1.5rem; text-align: center; padding: 16px 14px 12px; margin: 0 10px 10px; }
    .stq-words-row { padding: 12px 14px 14px; margin: 0 10px 12px; justify-content: center; }
    .stq-word-card { min-width: 60px; padding: 8px 10px; border-radius: 10px; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .stq-word-ar { font-size: 1.2rem; }
    .stq-ayah-footer { padding: 14px 16px 18px; }
    .stq-ayah-badge { width: 44px; height: 44px; font-size: 1.1rem; top: -22px; }
    .stq-action-btn { padding: 8px 12px; font-size: 0.75rem; border-radius: 12px; }
    .stq-portal-card { padding: 14px 16px; gap: 12px; }
    .stq-pc-ar-title { font-size: 1.1rem; }
    
    /* Mobile portal header adjustments */
    .stq-portal-header {
        padding: 50px 20px 40px;
        margin-bottom: 30px;
        border-radius: 20px;
    }
    
    .stq-portal-header::after {
        width: 150px;
        height: 90px;
        top: -45px;
    }
    
    .stq-portal-title {
        font-size: 1.7rem;
        margin-bottom: 8px;
    }
    
    .stq-portal-subtitle {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }
    
    .stq-portal-stats {
        flex-direction: column;
        gap: 12px;
        padding: 16px 20px;
        margin-bottom: 24px;
    }
    
    .stq-portal-stats .stq-dot-sep {
        display: none;
    }
    
    .stq-portal-stats .stat-item {
        width: 100%;
        justify-content: center;
    }
    
    .stq-portal-search {
        max-width: 100%;
    }
    
    .stq-portal-search input {
        padding: 14px 52px 14px 20px;
        font-size: 0.95rem;
    }
    
    .stq-portal-search button {
        width: 38px;
        height: 38px;
        right: 6px;
    }
    
    /* Hide orbs on mobile for performance */
    .stq-portal-header .orb {
        display: none;
    }
}
