/* Extracted from index.html <style> block */
:root {
    --section-gap: 28px;
}

/* Dashboard quota badges */
.quota-badges { display: inline-flex; gap: 8px; align-items: center; }
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid rgba(0,0,0,0.08);
    background: #f3f4f6;
    color: #111;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.06);
}
.badge--tier.badge--free { background: #e6e6e6; color: #333; border-color: rgba(0,0,0,0.06); }
.badge--tier.badge--paid { background: #fff2cc; color: #3a2b00; border-color: rgba(0,0,0,0.06); }
.badge--max { background: #fff; color: #111; border: 2px solid #000; }

@media (max-width: 600px) {
    .quota-badges { display: flex; flex-direction: column; gap: 6px; }
}

/* Delete button styling: dim shade of red */
.main-btn.delete-btn, .delete-btn {
    /* match main-btn sizing and shadow, but use a muted red background */
    background: #e57373; /* dim red */
    color: #fff;
    border: 2px solid #000;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 15px;
    box-shadow: 4px 4px 0px #000;
}
.main-btn.delete-btn:hover { filter: brightness(0.95); }

/* Use border-box everywhere to prevent elements from overflowing their containers on small screens */
*, *::before, *::after { box-sizing: border-box; }

body {
    background-color: #ffffff;
    /* textured pattern: stronger diagonal pinstripes + more visible radial accents */
    background-image: 
        repeating-linear-gradient(135deg, rgba(0,0,0,0.05) 0 2px, transparent 2px 24px),
        radial-gradient(circle at 10% 10%, rgba(255,235,205,0.06), transparent 18%),
        radial-gradient(circle at 90% 90%, rgba(205,235,255,0.05), transparent 22%),
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
    background-repeat: repeat, no-repeat, no-repeat, repeat;
    background-size: auto, 600px 600px, 450px 450px, 100% 100%;
    font-family: system-ui, -apple-system, sans-serif;
    color: #333;
    margin: 0;
    padding: 0;
}

.top-header {
    background-color: #eaf4ff;
    padding: 15px 20px;
    display: flex;
    justify-content: flex-start;
    gap: 14px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.top-header { align-items: center; position: relative; }

.header-right { margin-left: auto; display: flex; align-items: center; }

/* centered header navigation */
.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-btn {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #111;
    background: transparent;
    font-weight: 700;
    border: 2px solid transparent;
}

.nav-btn:hover {
    background: rgba(0,0,0,0.06);
}

/* active nav state */
.nav-btn.active {
    background: #fff;
    border: 2px solid #000;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.2);
    font-weight: 700;
}

.signup-btn {
    display: inline-block;
    background: #fff;
    color: #1a1a1a;
    border: 2px solid #000;
    padding: 8px 12px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.6);
}

.signup-btn:hover { transform: translateY(-2px); }

/* Distinct header button styles */
#signupBtn {
    background: #ffb74d; /* warm orange */
    color: #111;
    border-color: #b36b00;
}

#loginBtn {
    margin-left: 12px; /* space between buttons */
    background: #4caf50; /* green */
    color: #fff;
    border-color: #2e7d32;
}

#loginBtn:hover, #signupBtn:hover {
    filter: brightness(0.95);
}

/* Modal styles */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    z-index: 1200;
}

.modal.hidden { display: none; }

.modal-content {
    background: #fff;
    padding: 22px;
    border-radius: 12px;
    max-width: 420px;
    width: 92%;
    box-shadow: 8px 8px 0 rgba(0,0,0,0.25);
}

.modal-content h3 { margin: 0 0 12px 0; font-size: 18px; }
.modal-content label { display: block; margin-top: 10px; font-size: 13px; }
.modal-content input[type="text"], .modal-content input[type="email"], .modal-content input[type="password"] {
    width: 100%;
    padding: 10px;
    margin-top: 6px;
    border: 2px solid #000;
    border-radius: 8px;
    box-sizing: border-box;
}

.field-note {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
}

.field-note.error {
    color: #b00020;
}

.field-note.success {
    color: #0b6b0b;
    font-weight: 600;
}

/* Password display */
.password-display { text-align: center; margin-top: 14px; }
.password-box {
    background: #fff7d9;
    border: 2px solid #e6c94d;
    padding: 18px 14px;
    border-radius: 10px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #3a2b00;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.12);
    margin-bottom: 12px;
}

.password-display .main-btn { padding: 10px 16px; }

.modal-buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.modal-buttons .main-btn { padding: 8px 14px; }

/* Edit button variant inside modals */
.modal-buttons .edit-btn { background: #4caf50; color: #fff; border-color: #2e7d32; }
.modal-buttons .edit-btn.editing { background: #2e7d32; }

.header-link {
    text-decoration: none;
    color: #0b2545;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.2px;
    padding: 0; /* not a button */
    border: none;
    background: transparent;
}

.header-link:hover { text-decoration: underline; }

.affiliate-link {
    font-weight: 600;
}

.affiliate-cta {
    text-align: center;
    margin: var(--section-gap) 0;
}

.affiliate-cta a {
    display: inline-block;
    background: #fff6e6;
    color: #1a1a1a;
    border: 2px solid #000;
    padding: 12px 18px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.6);
}

.main-container {
    padding: 20px;
}

.hero-text {
    text-align: center;
    font-size: 24px;
    margin: 30px 0 var(--section-gap) 0;
    font-weight: 400;
}

.hero-text b { font-weight: 600; }

.tab-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: var(--section-gap);
}

.tab-container {
    background: #eaf4ff;
    padding: 5px;
    border-radius: 50px;
    border: 2px solid #000;
    display: flex;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.8);
    transition: opacity 0.3s ease;
}

/* Prevent tab switching and provide visual cue during loading */
.tabs-disabled {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.tab-btn {
    padding: 8px 25px;
    border-radius: 40px;
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: 500;
    background: transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #fff;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.1);
    font-weight: 600;
}

/* larger emoji styling for button icons */
.btn-emoji {
    display: inline-block;
    font-size: 1.3em;
    line-height: 1;
    margin-left: 8px;
}

.card {
    background: #eaf4ff;
    max-width: 700px;
    margin: 0 auto var(--section-gap) auto;
    padding: 30px;
    border-radius: 30px;
    box-shadow: 12px 12px 0px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0,0,0,0.1);
    position: relative;
}

/* Saved cards list layout */
.saved-list {
    display: flex !important;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: center;
    align-items: flex-start;
}

/* When using a card inside the saved list, prevent the global .card centering margin
   so the flex layout controls positioning */
.saved-card {
    margin: 0 !important;
    max-width: none !important;
    box-shadow: 8px 8px 0px rgba(0,0,0,0.35);
}

/* Fixed size cards for dashboard saved items */
.saved-card {
    width: 340px;
    height: 220px;
    display: flex;
    flex-direction: column;
    padding: 14px !important;
    border-radius: 18px !important;
}

.saved-card .card-header {
    text-align: center;
    font-weight: 700;
    margin-bottom: 8px;
}

.saved-card .card-body {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    color: #111;
    flex: 1 1 auto;
    overflow: hidden;
}

.saved-card .tadabbur-preview {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    max-height: 100%;
    overflow: hidden;
}

.saved-card .card-footer {
    margin-top: 10px;
    text-align: right;
}

.saved-card .main-btn {
    padding: 8px 12px;
    font-size: 14px;
}

/* Dot pattern for Tadabbur/Tafsir input areas and the result card */
#tadabbur-page.card,
#tafsir-page.card,
.affiliate-cta + .card {
    /* base color preserved, with a subtle repeating dot overlay */
    background-color: #eaf4ff;
    background-image: radial-gradient(rgba(0,0,0,0.06) 1px, transparent 1px);
    background-size: 12px 12px;
    background-position: 0 0;
}

@media (max-width: 600px) {
    /* keep result header in a single row and position edit button top-right */
    .result-header { flex-direction: row; align-items: center; justify-content: space-between; }
    #result { font-size: 16px; padding-top: 36px; }
    /* edit button: small, positioned absolute in the card's top-right */
    #editBtn { width: auto; padding: 6px 10px; font-size: 14px; border-radius: 8px; position: absolute; top: 12px; right: 12px; box-shadow: 2px 2px 0px rgba(0,0,0,0.2); }
    /* ensure edit button does not inherit large mobile copy-btn styles */
    .result-header #editBtn.copy-btn { margin: 0; }
}

/* edit button hidden by default; JS will show it for tadabbur only */
#editBtn { display: none; }

.sentence-container {
    text-align: center;
    font-size: 20px;
    line-height: 2.2;
}

.pill {
    appearance: none;
    background: #fff;
    border: 2px solid #000;
    border-radius: 50px;
    padding: 4px 15px;
    font-size: 16px;
    font-family: inherit;
    text-align: center;
    outline: none;
    margin: 0 4px;
}

select.pill {
    cursor: pointer;
    padding-right: 30px;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
}

.pill-sm { width: 70px; }
.pill-md { width: 140px; }
.pill-lg { width: 220px; }

.question-label {
    display: block;
    text-align: center;
    margin-top: 25px;
    font-weight: 500;
    font-size: 18px;
}

textarea {
    width: 100%;
    height: 100px;
    margin-top: 10px;
    padding: 15px;
    border: 2px solid #000;
    border-radius: 15px;
    font-size: 16px;
    font-family: inherit;
    box-sizing: border-box;
    max-width: 100%;
    box-sizing: border-box;
    resize: none;
    box-shadow: inset 4px 4px 0px rgba(0,0,0,0.1), 4px 4px 0px rgba(0,0,0,0.8);
}

.btn-container {
    text-align: center;
    margin-top: 25px;
}

.generate-note {
    overflow-x: hidden;
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 10px;
    color: #555;
    font-size: 13px;
    font-style: italic;
}

button.main-btn {
    background: #7aa6c9;
    color: white;
    border: 2px solid #000;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000;
    transition: all 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button.main-btn:active:not(:disabled) {
    box-shadow: 0px 0px 0px #000;
    transform: translate(4px, 4px);
}

button:disabled {
    background: #b0c4d6 !important;
    cursor: not-allowed;
    opacity: 0.8;
    box-shadow: 2px 2px 0px #000 !important;
    transform: translate(2px, 2px);
}

.copy-btn {
    background: #fff;
    color: #333;
    border: 2px solid #000;
    border-radius: 10px;
    font-size: 16px;
    padding: 10px 20px;
    margin-top: 15px;
    display: none;
    cursor: pointer;
    font-weight: 500;
    box-shadow: 3px 3px 0px #000;
    transition: transform 0.1s, box-shadow 0.1s;
}

/* small gap between copy and save buttons */
.btn-container .copy-btn { margin-right: 10px; }

/* Save button variant */
.save-btn {
    background: #ffe082; /* warm save color */
    color: #3a2b00;
    border-color: #d4a017;
}

@media screen and (max-width: 600px) {
    .copy-btn {
        display: block;
        width: 90%;
        padding: 18px 20px;
        font-size: 20px;
        border-radius: 15px;
        margin: 20px auto 0 auto;
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 500;
}

#result {
    line-height: 1.6;
    min-height: 50px;
    padding: 10px;
    font-size: 18px;
}

.hidden { display: none !important; }

/* editable result styling */
#result[contenteditable="true"] {
    background: #fff;
    border: 2px dashed rgba(0,0,0,0.08);
    padding: 14px;
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

/* Small info bubble with hover tooltip placed beside inputs */
.context-field-wrapper {
    display: inline-block;
    position: relative;
    vertical-align: middle;
}

.context-field-wrapper .pill {
    display: block;
}

.info-bubble {
    display: inline-flex;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    font-size: 11px;
    align-items: center;
    justify-content: center;
    position: absolute;
    /* overlap top-right corner of the input */
    top: 6px;
    right: 6px;
    transform: translate(50%, -50%);
    cursor: help;
}

.info-bubble .tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    background: #111;
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease-in-out;
    z-index: 30;
}
.info-bubble:hover .tooltip { opacity: 1; pointer-events: auto; }

@media (max-width: 480px) {
    .info-bubble { right: 0; top: -8px; }
    .info-bubble .tooltip { left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); }
}

/* Mobile-friendly adjustments */
@media (max-width: 800px) {
    .top-header { padding: 12px 12px; flex-wrap: wrap; }
    /* hide centered nav on small screens by default; toggled via JS */
    .header-center { position: static; transform: none; left: auto; margin: 8px 0; display: none; }
    .header-center.visible-mobile-nav { display: flex; }
    .header-right { margin-left: 0; width: 100%; display: flex; justify-content: flex-end; gap: 8px; }

    .hero-text { font-size: 20px; margin: 18px 0 20px; }
    .card { padding: 20px; border-radius: 18px; max-width: 100%; margin-left: 12px; margin-right: 12px; }

    .tab-btn { padding: 8px 14px; font-size: 16px; }

    .sentence-container { font-size: 16px; line-height: 1.9; }
    .pill-sm, .pill-md, .pill-lg { width: 100% !important; display: block; margin: 8px auto; }
    .context-field-wrapper { display: block; }
    .context-field-wrapper, .sentence-container { width: 100%; padding: 0 6px; }

    textarea { height: 120px; }

    .btn-emoji { display: none; }

    .card { box-shadow: 6px 6px 0px rgba(0,0,0,0.35); }

    .result-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    #result { font-size: 16px; }

    button.main-btn { width: 100%; padding: 12px 16px; font-size: 18px; }
}

@media (max-width: 480px) {
    .top-header { padding: 10px 10px; }
    .hero-text { font-size: 18px; }
    .card { padding: 16px; border-radius: 12px; }
    .tab-btn { padding: 6px 10px; font-size: 15px; }
    .sentence-container { font-size: 15px; line-height: 1.8; }
    textarea { height: 110px; }
    .password-box { font-size: 18px; padding: 12px 10px; }
    .modal-content { padding: 16px; max-width: 92%; }
    .modal-buttons { flex-direction: column-reverse; gap: 8px; }
    .modal-buttons .main-btn { width: 100%; }
    .saved-card { width: 100% !important; height: auto !important; }
    .saved-card .card-footer { text-align: center; }
}

/* header toggle button styling */
.header-toggle { display: none; background: transparent; border: 2px solid #000; border-radius: 10px; padding: 6px 10px; font-size: 18px; cursor: pointer; margin-left: 8px; }
@media (max-width: 800px) { .header-toggle { display: inline-flex; } }
