/* ═══════════════════════════════════════════════════════
   ASISTEN USTADZAH — Main Stylesheet
   Theme: Luxury Warm Peach Terracotta (Mobile-First)
   Fonts: Plus Jakarta Sans + Amiri
   ═══════════════════════════════════════════════════════ */

/* ── GOOGLE FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Amiri:wght@400;700&display=swap');

/* ── CSS VARIABLES ── */
:root {
    /* Peach Terracotta Palette */
    --bg-dark: #F5EDE5;
    --bg-light-blue: #fff0e5;

    /* Removed metallic gradients, replaced with flat/soft gradients */
    --silver-main: #ffffff;
    --silver-light: #ffffff;
    --silver-dark: rgba(255, 255, 255, 0.25);

    --silver-border-light: rgba(255, 255, 255, 0.4);
    --silver-border-dark: rgba(255, 203, 164, 0.8);

    /* Primary Accent (Terracotta) */
    --primary: #E2725B;
    --primary-light: #FFCBA4;
    --primary-dark: #C95A44;
    --primary-gradient: linear-gradient(135deg, #F6AC8A 0%, #E07560 100%);

    /* Background & Surface */
    --bg: #F5EDE5;
    --bg-warm: #fff0e5;
    --surface: #ffffff;
    --surface-hover: #fff9f5;

    /* Text */
    --text: #3E2312;
    --text-secondary: #6B4C35;
    --text-muted: #9B7055;

    /* Borders & Shadows */
    --border: rgba(226, 114, 91, 0.15);
    --border-active: rgba(226, 114, 91, 0.3);
    --shadow-sm: 0 2px 8px rgba(180, 100, 60, 0.05);
    --shadow-md: 0 8px 24px rgba(180, 100, 60, 0.08);
    --shadow-lg: 0 20px 50px rgba(180, 100, 60, 0.12);
    --shadow-silver: 0 8px 25px rgba(226, 114, 91, 0.05);

    /* Misc */
    --danger: #ef5350;
    --danger-light: rgba(239, 83, 80, 0.15);
    --success: #66bb6a;
    --radius-sm: 10px;
    --radius-md: 20px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Legacy compatibility */
    --accent: #E2725B;
    --bg-hover: rgba(255, 203, 164, 0.15);
    --text-dark: #3E2312;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.95);
}

/* ── RESET ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.Amiri {
    font-family: 'Amiri', serif;
    line-height: 2;
    direction: rtl;
}

/* ── APP CONTAINER ── */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0 0 90px;
    position: relative;
    z-index: 1;
}

/* ── BACKGROUND PATTERN ── */
.bg-pattern {
    display: none;
}

/* ── HEADER ── */
header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: transparent !important;
    border-radius: 0 !important;
    padding: 1.25rem 1.25rem 0.5rem !important;
    margin: 0 0 1rem 0 !important;
    color: var(--text) !important;
    box-shadow: none !important;
    position: relative !important;
    z-index: 100 !important;
}

.header-left {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
}

.btn-back {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(180, 100, 60, 0.05) !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
    font-size: 1rem !important;
}

.btn-back:hover,
.btn-back:active {
    background: var(--surface-hover) !important;
    color: var(--primary) !important;
    border-color: var(--border-active) !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(180, 100, 60, 0.08) !important;
}

/* ── LOGO ── */
.logo-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
}

.app-logo {
    display: none !important; /* Hide app logo in header to keep subpages clean and minimal */
}

h1 {
    margin: 0 !important;
    line-height: 1.2 !important;
}

.logo-container h1:first-of-type {
    font-size: 0.72rem !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    color: var(--text-secondary) !important;
    font-weight: 500 !important;
    font-family: 'Inter', sans-serif !important;
}

.logo-container h1:last-of-type {
    font-size: 1.2rem !important;
    color: var(--text) !important;
    font-weight: 700 !important;
    font-family: 'Cinzel', serif !important;
}

/* ── HERO ── */
.hero {
    margin-bottom: 1.5rem;
    text-align: center;
    padding: 0 1.25rem;
}

.hero h2 {
    font-size: 2.2rem;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    color: var(--text);
    font-weight: 700;
}

.hero .highlight {
    color: var(--primary-light);
    position: relative;
    display: inline-block;
}

.hero .highlight::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 0;
    width: 100%;
    height: 5px;
    background: rgba(226, 114, 91, 0.3);
    z-index: -1;
    border-radius: 3px;
}

.hero p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ── CARDS ── */
.generator-card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    padding: 1.5rem;
    box-shadow: var(--shadow-md) !important;
    margin-bottom: 1.5rem;
    position: relative;
}

.generator-card::before {
    display: none !important; /* Hide legacy metallic inset border */
}

/* ── INPUTS ── */
.input-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    letter-spacing: 0.3px;
}

input,
select {
    width: 100%;
    padding: 0.85rem 1rem;
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--text-dark);
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    box-shadow: 0 2px 6px rgba(180,100,60,0.04) !important;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(226, 114, 91, 0.15) !important;
}

input::placeholder {
    color: rgba(28, 40, 51, 0.5);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231c2833' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

select option, select optgroup {
    background-color: #ffffff;
    color: var(--text-dark);
    font-weight: 400;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* ── BUTTONS ── */
.btn-primary {
    width: 100%;
    background: var(--silver-dark);
    color: var(--text);
    padding: 0.95rem;
    border: 1px solid var(--silver-border-light);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 4px 12px rgba(0,0,0,0.4);
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--silver-border-dark);
}

.btn-primary:hover {
    background: var(--silver-main);
    color: var(--text-dark);
    transform: translateY(-1px);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.3), 0 6px 20px rgba(0,0,0,0.5);
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(226, 114, 91, 0.1);
    color: var(--primary);
    border: 1px solid rgba(226, 114, 91, 0.3);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: rgba(226, 114, 91, 0.2);
    border-color: var(--primary);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
    padding: 0.5rem;
}

.btn-ghost:hover {
    color: var(--text);
}

/* ── RESULT SECTION (Overlay) ── */
.result-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 9999;
    background: rgba(255, 246, 240, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1.5rem 1rem;
    overflow-y: auto;
    animation: popupZoom 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.result-container {
    max-width: 700px;
    margin: 0 auto;
    background: var(--silver-main);
    padding: 2rem 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.3), inset 0 -4px 8px rgba(0,0,0,0.5), 0 8px 16px rgba(0,0,0,0.6);
    border: 1px solid var(--silver-border-light);
    border-bottom: 3px solid var(--silver-border-dark);
}

.result-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid rgba(28, 40, 51, 0.2);
    text-align: center;
}

.result-header h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    font-weight: 700;
}

.result-content {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 2;
    color: var(--text-dark);
    white-space: pre-line;
    padding-bottom: 1.5rem;
    text-align: left;
    transition: font-size 0.3s ease;
}

.reference {
    display: inline-block;
    margin-top: 0.3rem;
    padding: 0.2rem 0.65rem;
    background: rgba(28, 40, 51, 0.08);
    border-left: 3px solid var(--text-dark);
    border-radius: 0 6px 6px 0;
    color: var(--text-dark);
    font-style: italic;
    font-size: 0.72em;
    font-weight: 400;
    letter-spacing: 0.2px;
    opacity: 0.75;
}

.reference::before {
    content: '📎 Sumber: ';
    font-style: normal;
    opacity: 0.8;
}

/* ── ACTIONS ── */
.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.btn-action {
    background: var(--silver-dark);
    border: 1px solid var(--silver-border-light);
    color: var(--text);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.btn-action:hover {
    background: var(--silver-main);
    color: var(--text-dark);
    border-color: var(--silver-border-light);
    transform: translateY(-2px);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.3), 0 4px 8px rgba(0,0,0,0.4);
}

.close-btn {
    background: rgba(239, 83, 80, 0.2);
    color: var(--danger);
    border-color: rgba(239, 83, 80, 0.3);
}

.close-btn:hover {
    background: var(--danger) !important;
    color: #fff !important;
    border-color: var(--danger) !important;
}

/* ── NASKAH EDITOR ── */
.naskah-editor {
    width: 100%;
    min-height: 50vh;
    max-height: 70vh;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    font-size: 1rem;
    line-height: 2;
    color: var(--text-dark);
    resize: vertical;
    font-family: 'Amiri', 'Plus Jakarta Sans', serif;
    transition: var(--transition);
    overflow-y: auto;
}

.naskah-editor:focus {
    outline: none;
    border-color: var(--silver-border-light);
    box-shadow: 0 0 0 4px rgba(226, 114, 91, 0.1);
}

.naskah-editor::placeholder {
    color: rgba(28, 40, 51, 0.4);
    font-style: italic;
}

/* ── EDITOR PANEL ── */
.editor-panel {
    background: rgba(28, 40, 51, 0.08);
    border: 1px solid rgba(226, 114, 91, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-top: 1rem;
}

.panel-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: 0.6px;
    margin-bottom: 0.7rem;
}

.panel-status {
    font-size: 0.72rem;
    color: var(--text-dark);
    margin-top: 0.5rem;
    min-height: 1.2em;
    font-style: italic;
    opacity: 0.7;
}

.panel-status.success {
    color: var(--success);
    opacity: 1;
}

.panel-status.error {
    color: var(--danger);
    opacity: 1;
}

.panel-status.loading {
    color: var(--text);
    opacity: 1;
}

.dalil-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.panel-select {
    flex: 2;
    min-width: 120px;
    padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-sm);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.82rem;
    color: var(--text-dark);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.panel-select:focus {
    outline: none;
    border-color: var(--silver-border-light);
}

.panel-select option, .panel-select optgroup {
    background: #ffffff;
    color: var(--text-dark);
}

.panel-input-ayat {
    flex: 0 0 70px;
    padding: 0.6rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-sm);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.82rem;
    color: var(--text-dark);
    text-align: center;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.panel-input-text {
    flex: 1;
    padding: 0.65rem 0.85rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-sm);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.82rem;
    color: var(--text-dark);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.panel-input-text:focus,
.panel-input-ayat:focus {
    outline: none;
    border-color: var(--silver-border-light);
}

.panel-input-text::placeholder {
    color: rgba(139, 126, 106, 0.5);
}

.ai-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ── PANEL BUTTONS ── */
.btn-panel-action {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-panel-action:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-panel-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-ai-process {
    background: linear-gradient(135deg, #B28D44, #7C3AED);
    color: white;
}

.btn-panel-add-paragraph {
    background: transparent;
    border: 1.5px dashed var(--border-active);
    color: var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.55rem 1rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 0.6rem;
    transition: var(--transition);
}

.btn-panel-add-paragraph:hover {
    background: var(--bg-hover);
    border-style: solid;
}

/* ── EDITOR TOOLBAR & FOOTER ── */
.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tool-btn {
    padding: 0.65rem 1rem;
    background: var(--bg-hover);
    border: 1.5px solid var(--border-active);
    color: var(--primary-dark);
    border-radius: var(--radius-sm);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.tool-btn:hover {
    background: rgba(178, 141, 68, 0.12);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.tool-btn-full {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9rem;
}

.editor-footer {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.btn-reset-naskah {
    background: transparent;
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-reset-naskah:hover {
    background: var(--danger-light);
    border-color: var(--danger);
}

/* ── CURSOR CONTEXT ── */
.cursor-context {
    font-size: 0.78rem;
    color: #1c2833;
    font-weight: 700;
    font-style: normal;
    padding: 0.5rem 0.85rem;
    background: rgba(28, 40, 51, 0.1);
    border: 1px solid rgba(28, 40, 51, 0.15);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: var(--transition);
}

/* ── MINI MODAL ── */
.editor-mini-modal {
    background: var(--surface);
    border: 1.5px solid var(--border-active);
    border-radius: 14px;
    margin-top: 0.6rem;
    overflow: hidden;
    animation: modalSlideDown 0.25s ease;
    box-shadow: var(--shadow-md);
}

@keyframes modalSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mini-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.mini-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.25rem;
    line-height: 1;
}

.mini-modal-close:hover {
    color: var(--danger);
}

.mini-modal-body {
    padding: 0.75rem 1rem;
}

/* ── HISTORY SECTION ── */
.history-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1.5px dashed var(--border);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h4 {
    color: var(--primary-dark);
    font-size: 1rem;
    font-weight: 700;
}

.btn-ghost-small {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    text-decoration: underline;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.history-item {
    background: var(--surface);
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
}

.history-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary-dark);
}

.history-item .h-title {
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item .h-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.empty-msg {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
    padding: 1.5rem;
}

/* ── TELEPROMPTER ── */
.teleprompter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: #1a1a1a;
    color: #fff;
    z-index: 9999;
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.tele-controls {
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    padding: 1rem;
    margin: -2rem -2rem 2rem -2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    z-index: 10;
    border-bottom: 1px solid #333;
    flex-wrap: wrap;
}

.btn-tele-control {
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #444;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.btn-tele-control:hover {
    background: #3a3a3a;
    border-color: #666;
}

.speed-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tele-content {
    font-size: 2.2rem;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    padding-bottom: 50vh;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ── LOADING OVERLAY ── */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(255, 246, 240, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text);
    text-align: center;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loading-content p {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

#loadingSubtext {
    font-size: 0.85rem;
    opacity: 0.7;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ── PULSE LOGO SPINNER ── */
img.pulse-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(226, 114, 91, 0.2);
    animation: pulseLogo 1.5s infinite ease-in-out;
}

@keyframes pulseLogo {
    0% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 0 rgba(226, 114, 91, 0.4); }
    50% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 20px rgba(226, 114, 91, 0.6); }
    100% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 0 rgba(226, 114, 91, 0.4); }
}

/* ═══════════════════════════════════════════════════════
   LOGIN OVERLAY
   ═══════════════════════════════════════════════════════ */
#login-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #FFF6F0;
    
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    margin-bottom: 1rem;
    object-fit: contain;
    background: #f8f6f0;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.login-card h1 {
    font-family: 'Cinzel', 'Plus Jakarta Sans', serif;
    font-size: 1.4rem;
    color: var(--text);
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
}

.login-card h2 {
    font-size: 0.85rem;
    color: #B38B59;
    font-weight: 400;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.login-card p {
    font-size: 0.85rem;
    color: #78909c;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

/* Login Tabs (Email / No. HP) */
.login-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.login-tab {
    flex: 1;
    padding: 0.65rem 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1.5px solid rgba(226, 114, 91, 0.3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.15);
    color: #a0a0a0;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.login-tab.active {
    background: rgba(226, 114, 91, 0.15);
    border-color: var(--text);
    color: var(--text);
}

.login-tab:hover:not(.active) {
    border-color: rgba(226, 114, 91, 0.4);
    color: var(--primary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-form input[type="email"],
.login-form input[type="tel"] {
    width: 100%;
    padding: 0.9rem 1rem;
    background: #fdfbfb;
    border: 1.5px solid rgba(226, 114, 91, 0.3);
    border-radius: 12px;
    color: var(--text-dark);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    text-align: center;
    transition: border-color 0.3s;
}

.login-form input[type="email"]:focus,
.login-form input[type="tel"]:focus {
    outline: none;
    border-color: var(--text);
}

.login-form input[type="email"]::placeholder,
.login-form input[type="tel"]::placeholder {
    color: #a0a0a0;
}

.login-form .btn-primary {
    width: 100%;
    padding: 0.9rem;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.login-form .btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.login-form .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#login-error {
    font-size: 0.8rem;
    color: #ef5350;
    min-height: 1.2em;
    margin-top: 0.25rem;
}

/* Content blur when login is shown */
.content-blurred {
    filter: blur(4px);
    pointer-events: none;
}

/* ── SIMPLE LOADER ── */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

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

/* ── FOOTER ── */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ── PRINT ── */
@media print {
    .bg-pattern,
    header,
    .hero,
    .generator-card,
    footer,
    .result-header,
    .history-section,
    .bottom-nav {
        display: none !important;
    }
    .app-container {
        max-width: 100%;
        padding: 0;
    }
    .result-section {
        position: relative !important;
        height: auto !important;
        overflow: visible !important;
        width: 100% !important;
        box-shadow: none;
        padding: 0;
        background: white !important;
    }
    .result-container {
        border: none;
        background: white !important;
    }
    .result-content {
        font-size: 14pt;
        color: black !important;
        text-align: left !important;
    }
    .dalil-block {
        background: transparent !important;
        box-shadow: none !important;
        border-color: #ddd !important;
        border-left: 5pt solid #B28D44 !important;
        padding: 1rem !important;
        margin: 2rem 0 !important;
        page-break-inside: avoid;
    }
    .dalil-block .arabic {
        color: black !important;
        text-shadow: none !important;
        font-size: 18pt !important;
    }
    .dalil-block .transliteration,
    .dalil-block .translation,
    .dalil-block .reference {
        color: black !important;
    }
}

/* ── MOBILE RESPONSIVE ── */
@media (max-width: 480px) {
    .app-container {
        padding: 1rem 1rem 5.5rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .result-section {
        padding: 0 !important;
    }

    .result-container {
        padding: 1rem !important;
        border-radius: var(--radius-lg);
        border-width: 0;
        max-width: 100%;
    }

    .result-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        gap: 0.5rem;
    }

    .result-header h3 {
        font-size: 1.15rem;
    }

    .result-content {
        font-size: 1.1rem;
        line-height: 1.9;
    }

    .naskah-editor {
        min-height: 45vh;
        max-height: none;
        font-size: 0.95rem;
        padding: 0.9rem;
        line-height: 1.9;
        border-radius: var(--radius-sm);
    }

    .naskahViewer {
        font-size: 1.05rem;
        padding: 0.5rem;
    }

    .editor-toolbar {
        margin-top: 0.4rem;
    }

    .editor-footer {
        margin-top: 0.6rem;
        padding-top: 0.6rem;
    }

    .editor-mini-modal {
        border-radius: var(--radius-sm);
    }

    .mini-modal-header {
        padding: 0.5rem 0.75rem;
    }

    .mini-modal-body {
        padding: 0.5rem 0.75rem;
    }

    .dalil-input-row {
        flex-direction: column;
    }

    .panel-select {
        width: 100%;
    }

    .panel-input-ayat {
        width: 100%;
        flex: auto;
    }

    .btn-panel-action {
        width: 100%;
    }

    .ai-input-row {
        flex-direction: column;
    }

    .btn-ai-process {
        width: 100%;
    }

    .teleprompter-overlay {
        padding: 1rem;
    }

    .tele-controls {
        margin: -1rem -1rem 1.5rem -1rem;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .btn-tele-control {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    .tele-content {
        font-size: 1.6rem;
        line-height: 1.5;
    }
}

/* ── SAFE AREA (iPhone notch) ── */
@supports(padding-bottom: env(safe-area-inset-bottom)) {
    .app-container {
        padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    }
}

/* ── TIER BADGES (LITE vs PRO) ── */
.tier-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    vertical-align: middle;
}
.tier-pro {
    background: linear-gradient(135deg, #E2725B 0%, #C95A44 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(226, 114, 91, 0.35);
}
.tier-lite {
    background: #eed8c9;
    color: #8c5b3e;
    border: 1px solid rgba(140, 91, 62, 0.25);
}
.menu-item.locked {
    position: relative;
}
.menu-item.locked::after {
    content: '🔒 PRO';
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #E2725B 0%, #C95A44 100%);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(226, 114, 91, 0.35);
    letter-spacing: 0.5px;
    z-index: 5;
}

/* ═══════════════════════════════════════════════════════
   PRINT / PDF FIX (MULTIPLE PAGES OVERFLOW FIX)
   ═══════════════════════════════════════════════════════ */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .app-container, .container, main {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    .result-section {
        position: relative !important;
        height: auto !important;
        overflow: visible !important;
        width: 100% !important;
        box-shadow: none !important;
        padding: 0 !important;
        background: #ffffff !important;
    }
    header, footer, .bottom-nav, .actions-row, .btn, .btn-primary, .control-btn, 
    .lock-overlay-ustadzah, #login-overlay, .editor-toolbar, .editor-footer, 
    .floating-controls, .reading-float-controls, .fab-show-menu, .header-widgets {
        display: none !important;
    }
    .result-content {
        font-size: 12pt !important;
        line-height: 1.8 !important;
        color: #000000 !important;
    }
}


