/* ═══════════════════════════════════════════════════════
   ASISTEN MUBALIGH — Main Stylesheet
   Theme: Dark Blue + Silver Metallic (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 {
    /* Dark Blue + Silver Metallic Palette */
    --bg-dark: #071324;
    --bg-light-blue: #162c52;

    /* Silver/Chrome Gradients */
    --silver-main: linear-gradient(135deg, #b0bec5 0%, #ffffff 35%, #90a4ae 70%, #455a64 100%);
    --silver-light: linear-gradient(135deg, #ffffff 0%, #eceff1 55%, #b0bec5 100%);
    --silver-dark: linear-gradient(135deg, #37474f 0%, #212121 100%);

    --silver-border-light: #ffffff;
    --silver-border-dark: #546e7a;

    /* Primary Accent (Gold for call-to-action) */
    --primary: #cfd8dc;
    --primary-light: #ffffff;
    --primary-dark: #1c2833;
    --primary-gradient: var(--silver-light);

    /* Background & Surface */
    --bg: #071324;
    --bg-warm: #0d1f3c;
    --surface: rgba(22, 44, 82, 0.6);
    --surface-hover: rgba(22, 44, 82, 0.8);

    /* Text */
    --text: #cfd8dc;
    --text-secondary: #90a4ae;
    --text-muted: #546e7a;

    /* Borders & Shadows */
    --border: rgba(207, 216, 220, 0.1);
    --border-active: rgba(207, 216, 220, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-silver: 0 8px 25px rgba(176, 190, 197, 0.2);

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

    /* Legacy compatibility */
    --accent: #cfd8dc;
    --bg-hover: rgba(207, 216, 220, 0.06);
    --text-dark: #1c2833;
    --white: #ffffff;
    --glass: rgba(22, 44, 82, 0.85);
}

/* ── 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);
    background-image: radial-gradient(circle at 50% 10%, rgba(32, 60, 107, 0.8) 0%, var(--bg-dark) 80%);
    background-attachment: fixed;
    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;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1.25rem 1.25rem 0;
}

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

.btn-back {
    background: var(--silver-dark);
    border: 1px solid var(--silver-border-light);
    color: var(--text);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-size: 1.1rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3);
    border-bottom: 2px solid var(--silver-border-dark);
}

.btn-back:hover,
.btn-back:active {
    background: var(--silver-main);
    color: var(--text-dark);
    border-color: var(--silver-border-light);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.3), 0 4px 12px rgba(0,0,0,0.5);
}

/* ── LOGO ── */
.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.3px;
}

h1 span {
    color: var(--primary-light);
}

/* ── 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(207, 216, 220, 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(--silver-main);
    border: 1px solid var(--silver-border-light);
    border-bottom: 3px solid var(--silver-border-dark);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.3), inset 0 -3px 6px rgba(0,0,0,0.5), 0 6px 12px rgba(0,0,0,0.5);
    margin-bottom: 1.5rem;
    position: relative;
}

.generator-card::before {
    content: '';
    position: absolute;
    top: 3px; left: 3px; right: 3px; bottom: 3px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    pointer-events: none;
}

/* ── 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: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    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: inset 0 1px 3px rgba(0,0,0,0.3);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--silver-border-light);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3), 0 0 0 3px rgba(207, 216, 220, 0.1);
}

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 {
    background-color: #1c2833;
    color: #cfd8dc;
    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(22, 44, 82, 0.5);
    color: var(--text);
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(22, 44, 82, 0.8);
    border-color: var(--border-active);
}

.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(7, 19, 36, 0.97);
    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(207, 216, 220, 0.06);
}

.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(207, 216, 220, 0.15);
    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 {
    background: #1c2833;
    color: #cfd8dc;
}

.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(7, 19, 36, 0.97);
    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;
}

/* ── ISLAMIC SPINNER ── */
.islamic-spinner {
    width: 64px;
    height: 64px;
    border: 3px double var(--primary);
    border-radius: 20%;
    position: relative;
    animation: islamicRotate 4s linear infinite;
}

.islamic-spinner::before,
.islamic-spinner::after {
    content: '';
    position: absolute;
    border-radius: 4px;
    background: var(--primary);
}

.islamic-spinner::before {
    width: 6px;
    height: 6px;
    top: -3px;
    left: 50%;
    margin-left: -3px;
}

.islamic-spinner::after {
    width: 8px;
    height: 8px;
    bottom: -4px;
    left: 50%;
    margin-left: -4px;
    background: var(--primary-light);
}

@keyframes islamicRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════════════
   LOGIN OVERLAY
   ═══════════════════════════════════════════════════════ */
#login-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #071324;
    background-image: radial-gradient(circle at 50% 10%, rgba(32, 60, 107, 0.8) 0%, #071324 80%);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background: rgba(22, 44, 82, 0.95);
    border: 1px solid rgba(207, 216, 220, 0.2);
    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: #cfd8dc;
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
}

.login-card h2 {
    font-size: 0.85rem;
    color: #90a4ae;
    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(207, 216, 220, 0.3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.15);
    color: #546e7a;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.login-tab.active {
    background: rgba(207, 216, 220, 0.15);
    border-color: #cfd8dc;
    color: #cfd8dc;
}

.login-tab:hover:not(.active) {
    border-color: rgba(207, 216, 220, 0.5);
    color: #b0bec5;
}

.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: #0d1f3c;
    border: 1.5px solid rgba(207, 216, 220, 0.3);
    border-radius: 12px;
    color: #f5f7f8;
    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: #cfd8dc;
}

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

.login-form .btn-primary {
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, #b0bec5, #90a4ae);
    border: none;
    border-radius: 12px;
    color: #071324;
    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: linear-gradient(135deg, #cfd8dc, #b0bec5);
    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));
    }
}
