/* =====================================================
   HOLIDAY GREETINGS — Clean Light Design
   RTL Kurdish
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap');

/* ── Variables ── */
:root {
    --primary: #3D7A6B;
    --primary-lt: #EAF4F1;
    --primary-dk: #2E5F54;
    --accent: #E8A838;
    --danger: #E05454;
    --bg: #F4F6F5;
    --surface: #FFFFFF;
    --border: #E0E8E5;
    --text: #1A2B27;
    --text-sub: #6B8880;
    --shadow-sm: 0 2px 10px rgba(61, 122, 107, 0.08);
    --shadow-md: 0 8px 32px rgba(61, 122, 107, 0.13);
    --shadow-lg: 0 20px 60px rgba(61, 122, 107, 0.18);
    --radius: 20px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --tr: all 0.28s var(--ease);
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Noto Naskh Arabic', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Header ── */
.site-header {
    padding: 28px 20px 12px;
    text-align: center;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.site-logo {
    height: 52px;
    width: auto;
    object-fit: contain;
}

.site-logo-text {
    font-size: 40px;
    display: inline-block;
}

.site-title {
    font-size: clamp(1.3rem, 5vw, 2rem);
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.3px;
}

/* ── Steps Indicator ── */
.steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px 10px;
    max-width: 380px;
    margin: 0 auto;
    gap: 0;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.35;
    transition: var(--tr);
    flex: 0 0 auto;
    cursor: pointer;
}

.step-item.active {
    opacity: 1;
}

.step-item.done {
    opacity: 0.75;
}

.step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 700;
    transition: var(--tr);
    background: var(--surface);
    color: var(--text-sub);
}

.step-item.active .step-circle {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 16px rgba(61, 122, 107, 0.35);
    transform: scale(1.08);
}

.step-item.done .step-circle {
    border-color: #52C99B;
    background: #52C99B;
    color: #fff;
}

.step-item span {
    font-size: 0.73rem;
    color: var(--text-sub);
    font-weight: 600;
}

.step-item.active span {
    color: var(--primary);
}

.step-connector {
    flex: 1;
    height: 2px;
    background: var(--border);
    max-width: 56px;
    margin-bottom: 22px;
    border-radius: 2px;
    transition: var(--tr);
}

/* LTR Adjustments */
[dir="ltr"] body {
    text-align: left;
}

[dir="ltr"] .name-input {
    padding: 16px 18px 16px 50px;
    text-align: left;
    direction: ltr;
}

[dir="ltr"] .input-icon {
    left: auto;
    right: 16px;
}

[dir="ltr"] .text-radio {
    right: auto;
    left: 20px;
}

[dir="ltr"] .btn-arrow {
    transform: scaleX(-1);
    order: 2;
}

[dir="ltr"] .step-card h2,
[dir="ltr"] .step-card .step-desc {
    text-align: left !important;
}

[dir="ltr"] .lang-switcher {
    flex-direction: row;
}

[dir="ltr"] .btn-next {
    flex-direction: row;
}

/* ── Step Containers ── */
.step-container {
    display: none;
    padding: 10px 16px 28px;
    max-width: 660px;
    margin: 0 auto;
}

.step-container.active {
    display: block;
    animation: fadeUp 0.36s var(--ease);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Card ── */
.glass-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.step-card {
    padding: 32px 28px;
}

@media(max-width:600px) {
    .step-card {
        padding: 24px 18px;
    }
}

/* ── Step Header ── */
.step-header {
    text-align: center;
    margin-bottom: 28px;
}

.step-icon {
    font-size: 2.6rem;
    margin-bottom: 10px;
    display: block;
}

.step-header h2 {
    font-size: clamp(1.15rem, 4vw, 1.5rem);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.step-desc {
    color: var(--text-sub);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ── Name Input ── */
.input-group {
    position: relative;
    margin-bottom: 22px;
}

.name-input {
    width: 100%;
    padding: 16px 50px 16px 18px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 1.05rem;
    outline: none;
    transition: var(--tr);
    text-align: right;
    direction: rtl;
}

.name-input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(61, 122, 107, 0.1);
}

.name-input::placeholder {
    color: rgba(107, 136, 128, 0.6);
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    pointer-events: none;
    color: var(--text-sub);
}

.name-input.shake {
    animation: shake 0.45s var(--ease);
    border-color: var(--danger);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-7px);
    }

    40% {
        transform: translateX(7px);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

/* ── Buttons ── */
.btn-next {
    width: 100%;
    padding: 16px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--tr);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 18px rgba(61, 122, 107, 0.28);
}

.btn-next:hover:not(:disabled) {
    background: var(--primary-dk);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(61, 122, 107, 0.36);
}

.btn-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-next:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-arrow {
    font-size: 1.1rem;
    transition: transform 0.25s;
}

.btn-next:hover .btn-arrow {
    transform: translateX(-4px);
}

.loader-spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

.btn-back {
    padding: 12px 22px;
    background: transparent;
    color: var(--text-sub);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.93rem;
    cursor: pointer;
    transition: var(--tr);
}

.btn-back:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lt);
}

.btn-restart {
    padding: 12px 22px;
    background: rgba(82, 201, 155, 0.1);
    color: #2D9B6E;
    border: 1.5px solid rgba(82, 201, 155, 0.35);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.93rem;
    cursor: pointer;
    transition: var(--tr);
}

.btn-restart:hover {
    background: rgba(82, 201, 155, 0.18);
    transform: translateY(-1px);
}

.step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    flex-wrap: wrap;
}

/* ── Text Selection Cards ── */
.texts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
    max-height: 54vh;
    overflow-y: auto;
    padding: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.texts-grid::-webkit-scrollbar {
    width: 4px;
}

.texts-grid::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.text-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 40px;
    padding: 18px 24px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: var(--tr);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.text-card:hover {
    border-color: var(--primary);
    background: var(--primary-lt);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.text-card.selected {
    border-color: var(--primary);
    background: var(--primary-lt);
}

.text-card p {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.6;
    text-align: center;
    margin: 0 35px;
    /* Space for radio symmetry */
}

.text-radio {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: #fff;
    flex-shrink: 0;
    transition: var(--tr);
    position: absolute;
    right: 20px;
}

.text-card.selected .text-radio {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: inset 0 0 0 5px #fff;
}

.text-card:hover .text-radio {
    border-color: var(--primary);
}

.no-texts,
.no-graphic-msg {
    text-align: center;
    color: var(--text-sub);
    padding: 36px 20px;
    font-size: 0.93rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1.5px dashed var(--border);
}

/* ── Canvas ── */
.canvas-wrapper {
    position: relative;
    background: var(--bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 22px;
    border: 1.5px solid var(--border);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#greeting-canvas {
    width: 100%;
    height: auto;
    display: none;
    max-width: 100%;
    border-radius: var(--radius-sm);
}

.canvas-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 36px;
    color: var(--text-sub);
    font-size: 0.9rem;
    z-index: 100;
    background: var(--bg);
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    z-index: 10;
}

.loader-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.scanning-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, rgba(61, 122, 107, 0.05) 50%, transparent 100%);
    background-size: 100% 200%;
    animation: scanGradient 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, transparent, var(--primary), transparent);
    box-shadow: 0 0 15px var(--primary);
    z-index: 6;
    animation: scanLine 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes scanLine {
    0% {
        top: 0;
    }

    50% {
        top: 100%;
    }

    100% {
        top: 0;
    }
}

@keyframes scanGradient {
    0% {
        background-position: 0% 0%;
    }

    50% {
        background-position: 0% 100%;
    }

    100% {
        background-position: 0% 0%;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.fade-out {
    animation: fadeOut 0.4s ease-in forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Unified Action Buttons ── */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 10px;
}

.primary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.secondary-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--tr);
    border: none;
    outline: none;
}

.btn-main {
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-download {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dk) 100%);
}

.btn-share-all {
    background: linear-gradient(135deg, #1877F2 0%, #0088CC 100%);
}

.btn-main:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    filter: brightness(1.1);
}

.btn-alt {
    background: var(--surface);
    color: var(--text-sub);
    border: 1.5px solid var(--border);
    flex: 1;
    max-width: 150px;
    padding: 10px 15px;
    font-size: 0.88rem;
    font-weight: 600;
}

.btn-alt:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lt);
    transform: translateY(-2px);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--border);
    font-size: 0.8rem;
    font-weight: 600;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider span {
    padding: 0 10px;
    color: var(--text-sub);
}

@media(max-width: 500px) {
    .primary-actions {
        grid-template-columns: 1fr;
    }

    .secondary-actions .action-btn {
        flex: 1;
        max-width: none;
    }
}

/* ── Footer ── */
.site-footer {
    text-align: center;
    padding: 22px 20px;
    color: rgba(107, 136, 128, 0.6);
    font-size: 0.8rem;
}

/* ── Responsive ── */
@media(min-width:600px) {
    .texts-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media(min-width:1024px) {
    .step-card {
        padding: 40px;
    }

    .texts-grid {
        grid-template-columns: 1fr 1fr;
        max-height: 58vh;
    }
}

@media(max-width:480px) {
    .share-buttons {
        grid-template-columns: 1fr 1fr;
    }

    .share-label {
        grid-column: 1 / -1;
    }

    .step-nav {
        flex-direction: column-reverse;
        width: 100%;
    }

    .btn-back,
    .btn-restart {
        width: 100%;
        text-align: center;
    }
}