@import "https://static-iran.mehritcoserver.ir/fonts/iransansx/fontiran.css";

/* === CSS VARIABLES === */

:root {
    --bg: #ffffff;
    --bg2: #f4f5f7;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-border: rgba(0, 0, 0, 0.1);
    --text: #1a1a1a;
    --text-muted: #3e3e3e;
    --accent: #6399EC;
    --accent2: #4182e4;
    --accent-glow: rgba(99, 153, 236, 0.18);
    --gold: #e0a800;
    --shadow: rgba(0, 0, 0, 0.08);
    --card-bg: rgba(255, 255, 255, 0.2);
    --menu-bg: rgba(255, 255, 255, 0.97);
    --overlay: rgba(0, 0, 0, 0.55);
    --input-bg: rgba(245, 245, 245, 0.9);
    --step-dot: #FF353D;
    --radius: 20px;
    --font: 'IRANSansXFaNum', 'Noto Naskh Arabic', serif;
    --display-high-height: block;
    --font-icon-version: "Font Awesome 7 Pro";
}


[data-theme="dark"] {
    --bg: #1a1a1a;
    --bg2: #121212;
    --surface: rgba(30, 30, 30, 0.85);
    --surface-border: rgba(99, 153, 236, 0.15);
    --text: #ffffff;
    --text-muted: #a8a8a8;
    --accent: #6399EC;
    --accent2: #3a7bd2;
    --accent-glow: rgba(99, 153, 236, 0.22);
    --gold: #e0a800;
    --shadow: rgba(0, 0, 0, 0.6);
    --card-bg: rgba(0, 0, 0, 0.2);
    --menu-bg: rgba(10, 10, 10, 0.98);
    --overlay: rgba(0, 0, 0, 0.72);
    --input-bg: rgba(35, 35, 35, 0.95);
}

/* ===== Custom select styling ===== */
select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;

    background-color: var(--input-bg) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%233e3e3e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: left 16px center !important;
    background-size: 16px !important;

    border: 1px solid var(--surface-border) !important;
    border-image: none !important;
    box-shadow: none !important;
}

[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23a8a8a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E") !important;
}

select:hover {
    border-color: var(--accent);
}

select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

select:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* استایل گزینه‌ها را اکثر مرورگرها محدود اجازه می‌دهند، ولی همین حداقل باعث هماهنگی رنگ می‌شود */
select option {
    background: var(--menu-bg);
    color: var(--text);
}

/*Bug on Mobile phone (This line help improve Gsap Animation)*/
.flow-card {
    will-change: transform;
    transform: translateZ(0);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg2);
}

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    /*background: var(--bg2);*/
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(
            180deg,
            var(--accent),
            var(--accent2)
    );
    border-radius: 10px;
    border: 2px solid var(--bg2);
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
            180deg,
            var(--accent2),
            var(--accent)
    );
}

::-webkit-scrollbar-corner {
    /*background: var(--bg2);*/
}

/* === RESET & BASE === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.4s, color 0.4s;
    position: relative;
}

@media screen and (min-height: 320px) {
    :root {
        --display-high-height: none;
    }
}

@media screen and (min-height: 480px) {
    :root {
        --display-high-height: none;
    }
}

@media screen and (min-height: 640px) {
    :root {
        --display-high-height: none;
    }
}

@media screen and (min-height: 768px) {
    :root {
        --display-high-height: block;
    }
}

@media screen and (min-height: 1024px) {
    :root {
        --display-high-height: block;
    }
}

@media screen and (min-height: 1200px) {
    :root {
        --display-high-height: block;
    }
}

@media screen and (min-height: 1440px) {
    :root {
        --display-high-height: block;
    }
}

@media screen and (min-height: 1920px) {
    :root {
        --display-high-height: block;
    }
}

@media screen and (min-height: 2560px) {
    :root {
        --display-high-height: block;
    }
}


.nav-logo-lic {
    width: 100%;
    /*display: flex;*/
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    text-align: center;
    display: var(--display-high-height);
}

.nav-logo-lic a {
    width: 48px;
    height: 64px;
}

/* === BACKGROUND TEXTURE === */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(ellipse 70% 60% at 20% 80%, rgba(200, 120, 74, 0.09) 0%, transparent 70%),
    radial-gradient(ellipse 50% 50% at 80% 10%, rgba(212, 168, 75, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C8784A' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

/* === PRELOADER === */
#preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
}

.preloader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--surface-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.preloader-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === MAIN WRAPPER === */
#app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* === LOGO === */
#logo-wrap {
    position: fixed;
    z-index: 200;
    top: 50%;
    left: 50%;
    opacity: 0;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

#logo-wrap.corner {
    top: 20px;
    left: unset;
    right: 20px;
    transform: none;
    pointer-events: all;
    cursor: pointer;
}

.logo-img {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--gold) 100%);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px var(--shadow), 0 0 0 1px var(--surface-border);
    transition: box-shadow 0.3s;
}

.logo-img img {
    width: 40px;
    height: 40px;
    fill: white;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.03em;
    white-space: nowrap;
    text-align: center;
}

.logo-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}

#logo-wrap.corner .logo-text {
    font-size: 1.05rem;
}

#logo-wrap.corner .logo-sub {
    display: none;
}

#logo-wrap.corner .logo-img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
}

#logo-wrap.corner .logo-img svg {
    width: 24px;
    height: 24px;
}

/* === HAMBURGER MENU === */
#menu-toggle {
    position: fixed;
    top: 22px;
    left: 22px;
    z-index: 300;
    width: 44px;
    height: 44px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--shadow);
    transition: background 0.2s, transform 0.2s;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    backdrop-filter: blur(12px);
}

#menu-toggle:hover {
    background: var(--bg2);
}

.burger-line {
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

#menu-toggle.open .burger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

#menu-toggle.open .burger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

#menu-toggle.open .burger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* === SIDE MENU === */
#side-menu {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 290;
    width: 300px;
    height: 100vh;
    background: var(--menu-bg);
    border-right: 1px solid var(--surface-border);
    backdrop-filter: blur(20px);
    padding: 80px 0 8px;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 32px var(--shadow);
}

#side-menu.open {
    transform: translateX(0);
}

.menu-header {
    padding: 0 28px 24px;
    border-bottom: 1px solid var(--surface-border);
}

.menu-user-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.menu-avatar {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.menu-user-name {
    font-weight: 600;
    font-size: 1rem;
}

.menu-user-status {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.menu-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 28px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: right;
}

.menu-item:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

.menu-item.active {
    color: var(--accent);
    font-weight: 600;
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
}

.menu-divider {
    height: 1px;
    background: var(--surface-border);
    margin: 8px 28px;
}

.menu-footer {
    padding: 16px 28px;
}

.theme-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--surface-border);
    font-size: 0.88rem;
    color: var(--text-muted);
}

.switch-track {
    width: 40px;
    height: 22px;
    background: var(--bg2);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
    border: 1px solid var(--surface-border);
}

.switch-track.on {
    background: var(--accent);
}

.switch-thumb {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.switch-track.on .switch-thumb {
    transform: translateX(18px);
}

/* === MENU OVERLAY === */
#menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 280;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#menu-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* (banner replaced by #gallery-home.receded — see GALLERY HOME section below) */

.badge-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: rgba(255, 255, 255, 0.15) solid 2px;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.badge-container img {
    height: 64px;
    border: rgba(255, 255, 255, 0.15) dashed 2px;
    margin: 8px;
    border-radius: 8px;
    cursor: pointer;
}

@media (max-width: 360px) {
    .badge-container img {
        height: 52px;
        margin: 5px;
    }
}

.badge-container img:hover {
    border: var(--accent) solid 2px;
}

.badge-img-active {
    border: var(--gold) solid 2px !important;
}

/* === TOP BAR === */
#topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 210;
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    backdrop-filter: blur(16px);
}

/* === CARD SYSTEM === */
#card-stage {
    position: fixed;
    z-index: 100;
    bottom: calc(50% - 48px);
    left: 50%;
    height: 416px;
    max-height: 80%;
    transform: translate(-50%, 50%);
    width: 100%;
    max-width: 480px;
    padding: 0 20px;
    pointer-events: none;
    scroll-behavior: auto;
    /* فعال‌سازی اسکرول عمودی در صورت کمبود جا */
    /*overflow-y: auto;*/

    /* فعال‌سازی امکان تعامل و اسکرول کردن توسط کاربر */
    /*pointer-events: auto;*/

    /*scroll-behavior: auto;*/
    -ms-overflow-style: none; /* Internet Explorer 10+ */
    scrollbar-width: none; /* Firefox, Safari 18.2+, Chromium 121+ */

}

#card-stage::-webkit-scrollbar {
    display: none; /* Older Safari and Chromium */
}


.flow-card {
    background: var(--card-bg);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 36px 32px;
    box-shadow: 0 24px 64px var(--shadow), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
    backdrop-filter: blur(24px);
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(30px) scale(0.96);
    overflow: auto;
    height: 100%;
}

.flow-card.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.card-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px var(--accent-glow);
}

.card-icon i {
    font-size: 1.5rem;
    color: white;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    margin-bottom: 8px;
}

.card-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.7;
}

/* === STEP INDICATOR === */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--surface-border);
    transition: all 0.3s;
}

.step-dot.active {
    width: 24px;
    border-radius: 4px;
    background: var(--accent);
}

.step-dot.done {
    background: var(--gold);
}

/* === INPUTS === */
.input-group-rtl {
    position: relative;
    margin-bottom: 16px;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

.invalidInput {
    color: var(--step-dot) !important;
    font-weight: bolder !important;
    /*border: var(--red-color) solid 2px;*/
}

.styled-input {
    width: 100%;
    padding: 14px 4px 14px 4px;
    background: var(--input-bg);
    border: 1.5px solid var(--surface-border);
    border-radius: 14px;
    font-family: var(--font);
    font-size: 1rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.styled-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.styled-input::placeholder {
    color: var(--text-muted);
    font-family: var(--font);
    direction: rtl !important;
    text-align: right;
}

textarea.styled-input {
    resize: none;
    padding-top: 14px;
    min-height: 100px;
    line-height: 1.7;
}

.char-count {
    text-align: left;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.char-count.warn {
    color: var(--accent);
}

/* === BUTTONS === */
.btn-primary-custom {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.03em;
    box-shadow: 0 6px 20px var(--accent-glow);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
    position: relative;
    overflow: hidden;
}

.btn-primary-custom::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.15), transparent);
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px var(--accent-glow);
}

.btn-primary-custom:active {
    transform: translateY(0);
}

.btn-primary-custom:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary-custom {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--surface-border);
    border-radius: 14px;
    font-family: var(--font);
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}

.btn-secondary-custom:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0;
    margin-top: 16px;
    transition: color 0.2s;
}

.btn-back:hover {
    color: var(--accent);
}

/* === TEMPLATE SHEET (bottom-sheet overlay) === */
#template-sheet {
    position: fixed;
    inset: 0;
    z-index: 350;
    background: var(--overlay);
    display: none;
    align-items: flex-end;
    backdrop-filter: blur(6px);
}

#template-sheet.open {
    display: flex;
}

.tpl-sheet-inner {
    width: 100%;
    max-height: 88vh;
    background: var(--bg);
    border-radius: 28px 28px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.22);
}

#template-sheet.open .tpl-sheet-inner {
    transform: translateY(0);
}

.tpl-sheet-handle {
    width: 44px;
    height: 5px;
    background: var(--surface-border);
    border-radius: 3px;
    margin: 14px auto 0;
    flex-shrink: 0;
}

.tpl-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px 12px;
    border-bottom: 1px solid var(--surface-border);
    flex-shrink: 0;
}

.tpl-sheet-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.tpl-sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.88rem;
    transition: all 0.2s;
}

.tpl-sheet-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Scroll area */
.tpl-scroll-area {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px 0;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--surface-border) transparent;
}

.tpl-scroll-area::-webkit-scrollbar {
    width: 4px;
}

.tpl-scroll-area::-webkit-scrollbar-thumb {
    background: var(--surface-border);
    border-radius: 2px;
}

/* Grid inside sheet */
.template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding-bottom: 16px;
}

@media (min-width: 480px) {
    .template-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.template-card {
    aspect-ratio: 2/3;
    border-radius: 14px;
    border: 2px solid var(--surface-border);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.template-card:active {
    transform: scale(0.96);
}

@media (hover: hover) {
    .template-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 28px var(--shadow);
    }
}

.template-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.template-card .tpl-bg {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background-size: auto 100%; /* ارتفاع کامل، عرض اندازه‌گیری شود */
    background-position: right center; /* تصویر سمت راست قرار بگیرد */
    background-repeat: no-repeat;
    height: 100vh;
}

.template-card .tpl-emoji {
    font-size: 1.8rem;
    line-height: 1;
}

.template-card .tpl-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 18px 6px 7px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
    text-align: center;
    font-size: 0.7rem;
    color: white;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.template-card .check-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.2s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.template-card.selected .check-badge {
    opacity: 1;
    transform: scale(1);
}

.check-badge i {
    color: white;
    font-size: 0.65rem;
}

/* === SKELETON CARDS === */
.tpl-skeleton {
    aspect-ratio: 2/3;
    border-radius: 14px;
    background: var(--bg2);
    overflow: hidden;
    position: relative;
}

.tpl-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.12) 50%,
            transparent 100%
    );
    animation: shimmer 1.4s infinite;
    transform: translateX(-100%);
}

[data-theme="dark"] .tpl-skeleton::after {
    background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.06) 50%,
            transparent 100%
    );
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

/* Sentinel for infinite scroll */
#tpl-sentinel {
    height: 1px;
    width: 100%;
    margin-bottom: 8px;
}

/* Loader spinner inside sheet */
.tpl-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.tpl-loader-ring {
    width: 20px;
    height: 20px;
    border: 2px solid var(--surface-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Confirm bar at bottom of sheet */
.tpl-confirm-bar {
    flex-shrink: 0;
    padding: 14px 16px;
    border-top: 1px solid var(--surface-border);
    background: var(--bg);
    display: flex;
    gap: 10px;
    align-items: center;
}

.tpl-selected-preview {
    width: 44px;
    height: 56px;
    border-radius: 10px;
    flex-shrink: 0;
    background: var(--bg2);
    overflow: hidden;
    position: relative;
    border: 2px solid var(--surface-border);
    transition: border-color 0.2s;
}

.tpl-selected-preview.has-selection {
    border-color: var(--accent);
}

.tpl-selected-preview-bg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background-size: auto 100%; /* ارتفاع کامل، عرض اندازه‌گیری شود */
    background-position: right center; /* تصویر سمت راست قرار بگیرد */
    background-repeat: no-repeat;
    height: 100vh;
}

.tpl-confirm-info {
    flex: 1;
}

.tpl-confirm-info .tpl-info-label {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.tpl-confirm-info .tpl-info-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.tpl-confirm-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    border: none;
    border-radius: 12px;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 14px var(--accent-glow);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
    position: relative;
    overflow: hidden;
}

.tpl-confirm-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.15), transparent);
}

.tpl-confirm-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tpl-confirm-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 20px var(--accent-glow);
}

/* Trigger button inside card-template */
.tpl-open-btn {
    width: 100%;
    padding: 48px 16px;
    background: var(--surface);
    border: 2px dashed var(--surface-border);
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    transition: all 0.2s;
    font-family: var(--font);
    -webkit-tap-highlight-color: transparent;
}

.tpl-open-btn:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.tpl-open-btn-icon {
    font-size: 2rem;
    color: var(--accent);
}

.tpl-open-btn-label {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.tpl-open-btn-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Selected preview inside card-template */
.tpl-card-preview {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 5/2;
    margin-bottom: 16px;
    cursor: pointer;
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    display: none;
}

.tpl-card-preview-bg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    gap: 16px;
    background-size: auto 100%; /* ارتفاع کامل، عرض اندازه‌گیری شود */
    background-position: right center; /* تصویر سمت راست قرار بگیرد */
    background-repeat: no-repeat;
    height: 100vh;
}

.tpl-card-preview-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 12px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tpl-change-btn {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 3px 8px;
    cursor: pointer;
    color: white;
    font-family: var(--font);
    transition: background 0.2s;
}

.tpl-change-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* === PRESET TEXTS === */
.preset-texts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.preset-item {
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all 0.2s;
    line-height: 1.6;
}

.preset-item:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

/* === UPLOAD ZONE === */
.upload-zone {
    border: 2px dashed var(--surface-border);
    border-radius: 16px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
    position: relative;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.upload-zone input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 2.2rem;
    color: var(--accent);
    margin-bottom: 12px;
}

.upload-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.upload-preview {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    margin: 0 auto 12px;
    background: var(--bg2) center/cover no-repeat;
    border: 3px solid var(--accent);
    display: none;
}

/* === GENDER SELECTOR === */
.gender-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.gender-btn {
    padding: 16px 8px;
    background: var(--surface);
    border: 2px solid var(--surface-border);
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: var(--font);
}

.gender-btn i {
    font-size: 1.6rem;
}

.gender-btn span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.gender-btn:hover, .gender-btn.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.gender-btn.selected span {
    color: var(--accent);
    font-weight: 600;
}

/* === OTP INPUT === */
.otp-wrap {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    direction: ltr;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--font);
    background: var(--input-bg);
    border: 2px solid var(--surface-border);
    border-radius: 12px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.otp-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.otp-timer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.otp-timer span {
    color: var(--accent);
    font-weight: 600;
}

/* === DOMAIN SEARCH === */
.domain-preview {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    direction: ltr;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.domain-preview .domain-status {
    margin-right: auto;
}

.domain-preview .domain-status.available {
    color: #22C55E;
}

.domain-preview .domain-status.taken {
    color: #EF4444;
}

.domain-name {
    font-family: monospace;
    color: var(--text);
    font-weight: 600;
}

/* === SUCCESS CARD === */
.success-link-box {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.success-link-box:hover {
    border-color: var(--accent);
}

.link-text {
    font-size: 0.88rem;
    color: var(--accent);
    direction: ltr;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-copy {
    color: var(--text-muted);
    font-size: 1rem;
    transition: color 0.2s;
}

.link-copy:hover {
    color: var(--accent);
}

.payment-summary {
    background: linear-gradient(135deg, var(--accent-glow), transparent);
    border: 1px solid rgba(200, 120, 74, 0.25);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 20px;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.payment-row:not(:last-child) {
    border-bottom: 1px solid var(--surface-border);
}

.payment-label {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.payment-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.payment-total .payment-value {
    color: var(--accent);
    font-size: 1.1rem;
}

/* === GALLERY HOME (default landing surface) === */
#gallery-home {
    position: relative;
    z-index: 3;
    min-height: 100vh;
    opacity: 0;
    pointer-events: none;
}

/* Normal state: full page, shown on load and whenever no card flow is open */
#gallery-home.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Receded state: takes the exact place/shape the old banner image used to
   occupy (tilted card, bottom-right corner) while a creation-flow card is
   open. Purely a color layer now — no image — and fully non-interactive. */
#gallery-home.receded {
    position: fixed;
    width: 55vw;
    min-width: 380px;
    aspect-ratio: 9/16;
    height: auto;
    min-height: 0;
    right: -10vw;
    bottom: -8vh;
    left: auto;
    top: auto;
    transform-origin: center center;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.3);
    opacity: 1;
    pointer-events: none;
    z-index: 2;
    background: linear-gradient(135deg, #2C1810 0%, #5C3020 40%, #8B4A2A 70%, #C8784A 100%);
    contain: layout paint style;
}

#gallery-home.receded::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(200, 120, 74, 0.4) 0%, rgba(26, 20, 16, 0.6) 100%);
    border-radius: inherit;
    pointer-events: none;
}

.gallery-home-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 24px 32px;
}

.gallery-intro {
    text-align: center;
    margin-bottom: 28px;
}

.gallery-eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: var(--bg2);
    padding: 5px 16px;
    border-radius: 50px;
    margin-bottom: 14px;
}

.gallery-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.35;
}

.gallery-subtitle {
    font-size: 0.92rem;
    color: var(--text-muted);
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.8;
}

.gallery-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 22px;
}

.gallery-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.88rem;
    color: var(--text-muted);
    backdrop-filter: blur(16px);
    transition: all 0.25s;
}

.gallery-tab i {
    font-size: 0.8rem;
    opacity: 0.7;
}

.gallery-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--gold));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 24px var(--accent-glow);
}

.gallery-tab.active i {
    opacity: 1;
    color: #fff;
}

.gallery-tab:not(.active):hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Pinterest-style masonry: reads especially well in portrait. */
.gallery-grid {
    columns: 3;
    column-gap: 14px;
}

.gallery-tile {
    position: relative;
    display: block;
    width: 100%;
    break-inside: avoid;
    margin-bottom: 14px;
    aspect-ratio: 3 / 4;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--surface-border);
    background: var(--tile-bg, var(--bg2));
    cursor: pointer;
    padding: 0;
    text-align: right;
    font-family: var(--font);
    box-shadow: 0 10px 28px var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-tile:hover,
.gallery-tile:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px var(--shadow);
    outline: none;
}

.gallery-tile-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}

.gallery-tile-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 35%, rgba(0, 0, 0, 0.75) 100%);
    pointer-events: none;
}

.gallery-tile-info {
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    padding: 12px;
    color: #fff;
    background: linear-gradient(var(--card-bg) 75%, var(--bg2) 100%);
    border: 8px;
}

.gallery-tile-name {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    margin-bottom: 4px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    color: var(--text);
}

.gallery-tile-visits {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text);
}

.gallery-tile-visits i {
    font-size: 0.7rem;
}

.gallery-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.gallery-empty i {
    font-size: 1.8rem;
    color: var(--accent);
}

.gallery-fab {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 12px 32px var(--accent-glow);
    transition: transform 0.25s, box-shadow 0.25s;
    white-space: nowrap;
}

.gallery-fab:hover {
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 16px 40px var(--accent-glow);
}

/* === MEMORIAL PREVIEW OVERLAY === */
#memorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--overlay);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    padding: 20px;
}

#memorial-overlay.open {
    display: flex;
}

.memorial-frame-wrap {
    width: 100%;
    max-width: 80%;
    height: 85vh;
    background: var(--bg);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

#frame-content {
    position: relative;
    width: 100%;
    height: 100%;
}

#memorial-frame {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 8px;
    background: #fff;
}

.memorial-mobile-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
    border-radius: 8px;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    overflow: hidden;
}

.memorial-mobile-overlay.active {
    display: flex;
}

.memorial-mobile-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}

.memorial-mobile-overlay button {
    width: 64px;
    height: 64px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #333;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
    transition: transform .2s ease;
    position: relative;
    z-index: 1;
}

.memorial-mobile-overlay button:hover {
    transform: scale(1.08);
}

.frame-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--surface-border);
}

.frame-url {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 6px 12px;
    margin: 0 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    direction: ltr;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.frame-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #EF4444;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.frame-close:hover {
    background: rgba(239, 68, 68, 0.25);
}

.frame-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    gap: 20px;
    background: var(--bg2);
}

.preview-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--gold)) center/cover;
    border: 4px solid var(--accent);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.preview-name {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
}

.preview-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.8;
    background: var(--surface);
    border-radius: 16px;
    padding: 16px 20px;
    width: 100%;
}

.preview-visits {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.preview-visits i {
    color: var(--accent);
}


/* === LOGIN PANEL (in card) === */
.social-login-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.social-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    background: var(--surface);
    border: 1.5px solid var(--surface-border);
    border-radius: 14px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--text);
    transition: all 0.2s;
    width: 100%;
}

.social-btn:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.social-btn i {
    font-size: 1.2rem;
    width: 22px;
}

.divider-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.divider-or::before, .divider-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--surface-border);
}

/* === SETTINGS PANEL === */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.settings-memorial-item {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.settings-thumb {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--gold)) center/cover;
    flex-shrink: 0;
}

.settings-memorial-info {
    flex: 1;
}

.settings-memorial-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.settings-memorial-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.settings-memorial-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-active {
    background: rgba(34, 197, 94, 0.15);
    color: #22C55E;
}

.badge-expired {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}

/* ===================================================================
   === RESPONSIVE (mobile-first; site previously had no width-based
   === breakpoints beyond this file's original 600px tweak) ===
   =================================================================== */

/* --- Small phones (very narrow screens) --- */
@media (max-width: 380px) {
    .card-title {
        font-size: 1.05rem;
    }

    .otp-wrap {
        gap: 6px;
    }

    .otp-input {
        width: 38px;
        height: 48px;
        font-size: 1.1rem;
    }

    .gallery-grid {
        columns: 2;
        column-gap: 8px;
    }
}

/* --- Phones (base tweaks that used to be the only breakpoint) --- */
@media (max-width: 600px) {
    .flow-card {
        padding: 28px 20px;
    }

    .template-grid {
        gap: 8px;
    }

    #gallery-home.receded {
        width: 100vw;
        right: -20vw;
    }

    .gallery-grid {
        columns: 2;
        column-gap: 10px;
        padding: 0 16px 116px;
    }

    .gallery-title {
        font-size: 1.6rem;
    }

    #settings-content {
        height: min(60vh, 420px);
    }
}

/* --- Tablets (portrait) --- */
@media (min-width: 601px) and (max-width: 900px) {
    .gallery-home-inner {
        max-width: 660px;
    }

    .gallery-grid {
        columns: 3;
    }

    #card-stage {
        max-width: 460px;
    }
}

/* --- Tablets / small laptops and up: give the app real breathing room --- */
@media (min-width: 768px) {
    body {
        overflow-x: hidden;
    }

    /* Card flow gets a fixed, centered width instead of stretching edge-to-edge */
    #card-stage {
        max-width: 440px;
        height: 460px;
    }

    .flow-card {
        padding: 40px 36px;
    }

    /* Side menu becomes a touch wider and gets a subtle border/shadow polish */
    #side-menu {
        width: 320px;
    }

    /* Gallery / home surface gets more air and a proper masonry width */
    .gallery-home-inner {
        max-width: 760px;
        padding: 56px 32px 60px;
    }

    .gallery-title {
        font-size: 2.3rem;
    }

    .gallery-subtitle {
        max-width: 480px;
    }

    .gallery-grid {
        columns: 3;
        column-gap: 18px;
    }

    /* Receded gallery (banner slot) shouldn't dominate on wider viewports */
    #gallery-home.receded {
        width: 42vw;
        min-width: 320px;
        max-width: 480px;
    }

    .gallery-fab {
        bottom: 36px;
    }

    /* Settings list gets a bit more room to breathe */
    #settings-content {
        height: 380px;
    }
}

/* --- Desktop / large screens --- */
@media (min-width: 1024px) {
    #card-stage {
        max-width: 480px;
        height: 500px;
    }

    .gallery-home-inner {
        max-width: 980px;
    }

    .gallery-grid {
        columns: 4;
        column-gap: 20px;
    }

    .gallery-title {
        font-size: 2.6rem;
    }

    #gallery-home.receded {
        width: 34vw;
        max-width: 460px;
    }

    #settings-content {
        height: 420px;
    }

    .memorial-item {
        padding: 18px 22px;
    }
}

/* --- Very large / wide desktop screens --- */
@media (min-width: 1440px) {
    .gallery-home-inner {
        max-width: 1120px;
    }

    .gallery-grid {
        columns: 5;
    }
}

/* --- Fine pointer devices: restore comfortable hover affordances --- */
@media (hover: hover) and (min-width: 768px) {
    .memorial-item:hover .memorial-action {
        background: var(--accent);
        color: #fff;
    }
}

/* === ANIMATIONS === */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 var(--accent-glow);
    }
    70% {
        box-shadow: 0 0 0 10px transparent;
    }
    100% {
        box-shadow: 0 0 0 0 transparent;
    }
}

.pulse {
    animation: pulse-ring 2s infinite;
}

/* === LOADING BUTTON STATE === */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    border-radius: inherit;
    z-index: 1;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.termsBtn {
    text-decoration: none;
    color: var(--text);
    font-size: larger;
    font-weight: bolder;
    font-style: normal;
}

/* === تنظیمات لیست یادبودهای من === */

#settings-content {
    max-height: 496px;
    height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 6px 4px 2px;
    margin-bottom: 4px;
}

#settings-content::-webkit-scrollbar {
    width: 6px;
}

/* Empty state (rendered inline by JS as a <p>) */
#settings-content p {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 48px 12px;
}

.memorial-item {
    position: relative;
    background: linear-gradient(155deg, var(--surface) 0%, var(--bg2) 100%);
    border: 1px solid var(--surface-border);
    padding: 16px 18px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 6px 18px var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    animation: fadeUp 0.35s ease both;
}

.memorial-item::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    border-radius: 16px 0 0 16px;
    background: linear-gradient(180deg, var(--accent), var(--gold));
    opacity: 0.85;
}

.memorial-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px var(--shadow);
    border-color: var(--accent);
}

.memorial-info {
    flex-grow: 1;
    min-width: 0;
}

.memorial-item .success-link-box {
    background: var(--input-bg);
    margin-bottom: 10px !important;
}

.memorial-url {
    font-size: 0.9rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
    display: block;
}

.memorial-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.memorial-name::before {
    content: '\f004';
    font-family: var(--font-icon-version) !important;
    font-weight: 900;
    font-size: 0.72rem;
    color: var(--gold);
}

.memorial-expiry {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.memorial-expiry::before {
    content: '\f017';
    font-family: var(--font-icon-version) !important;
    font-weight: 400;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.memorial-action {
    flex-shrink: 0;
    margin-right: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--accent);
    background: var(--accent-glow);
    border: 1px solid var(--surface-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.memorial-action:hover {
    background: var(--accent);
    color: #fff;
    transform: scale(1.06);
    box-shadow: 0 6px 16px var(--accent-glow);
}

.pressAble {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-effect 600ms linear;
    pointer-events: none;
}

@keyframes ripple-effect {
    to {
        transform: scale(1);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .flow-card,
    #side-menu,
    #menu-toggle {
        backdrop-filter: none;
    }

    .flow-card {
        background-color: var(--bg);
    }
}

.clickable:hover {
    cursor: pointer;
}

.driver-popover-title,
.driver-popover-navigation-btns,
.driver-popover-description {
    font-family: var(--font);
}


.driver-popover-close-btn {
    display: none !important;
}

.driver-popover-footer-btn {
    margin-right: 8px;
    font-family: var(--font);
}

.heloIco {
    position: absolute;
    z-index: 200;
    top: 16px;
    right: 32px;
    border: solid 0.5px gray;
    border-radius: 16px;
    height: 32px;
    width: 32px;
    align-content: center;
    text-align: center;
    font-size: 24px;
    cursor: pointer;
    background-color: var(--bg);
}

.heloIco:hover {
    background-color: var(--card-bg);
    cursor: pointer;
    scale: 1.05;
}

.toast-js-element {
    font-family: var(--font) !important;
}


