/* ═══════════════════════════════════════════
   Image → Excel  ·  Site Stylesheet
   Elderly-friendly · Mobile-first · Bilingual
   ═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:        #4f46e5;
    --primary-dark:   #3730a3;
    --primary-light:  #818cf8;
    --primary-bg:     #eef2ff;
    --success:        #10b981;
    --success-dark:   #059669;
    --danger:         #ef4444;
    --bg:             #f0f4ff;
    --card:           #ffffff;
    --text:           #1e1b4b;
    --text-muted:     #64748b;
    --border:         #e2e8f0;
    --shadow:         0 4px 24px rgba(79, 70, 229, 0.10);
    --shadow-lg:      0 8px 48px rgba(79, 70, 229, 0.16);
    --radius:         24px;
    --radius-sm:      16px;
    --font-deva:      'Noto Sans Devanagari', 'Mangal', sans-serif;
    --font-ui:        'Inter', var(--font-deva);
}

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    font-size: 18px;
    line-height: 1.65;
    min-height: 100dvh;
}


/* ── PAGE WRAPPER ────────────────────────── */
.page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}


/* ── HERO ────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, #4338ca 0%, #7c3aed 55%, #c026d3 100%);
    padding: 36px 24px 56px;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* subtle dot pattern */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.07;
    background-image: radial-gradient(circle, #fff 1px, transparent 1px);
    background-size: 28px 28px;
}

.hero-inner {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 3.8rem;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25));
    animation: float 3.5s ease-in-out infinite;
    display: block;
}

.hero-title {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 800;
    color: white;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 16px rgba(0,0,0,0.2);
    line-height: 1.1;
}

.arrow {
    display: inline-block;
    animation: bounce-x 1.8s ease-in-out infinite;
    color: #a5f3fc;
}

.hero-sub {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.82);
    font-family: var(--font-deva);
    margin-top: 4px;
}

.hero-desc {
    margin-top: 14px;
    font-size: 1rem;
    color: rgba(255,255,255,0.75);
    line-height: 1.9;
    font-family: var(--font-deva);
}

.hero-desc span {
    font-size: 0.95rem;
}


/* ── STEP INDICATOR ──────────────────────── */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 20px 4px;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    gap: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.step-num {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: white;
    color: var(--text-muted);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--border);
    transition: all 0.4s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.step.active .step-num {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 18px rgba(79,70,229,0.45);
    transform: scale(1.08);
}

.step.done .step-num {
    background: var(--success);
    color: white;
    border-color: var(--success);
    box-shadow: 0 4px 18px rgba(16,185,129,0.35);
}

.step.done .step-num::after {
    content: '✓';
    font-size: 1.1rem;
}

/* hide the number when done — show checkmark only */
.step.done .step-num-text { display: none; }

.step-label {
    font-size: 0.82rem;
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.35;
    font-family: var(--font-deva);
    transition: color 0.3s;
}

.step.active .step-label { color: var(--primary); font-weight: 700; }
.step.done  .step-label  { color: var(--success);  font-weight: 600; }

.step-label small { font-size: 0.75rem; display: block; opacity: 0.85; }

.step-line {
    flex: 1;
    height: 3px;
    background: var(--border);
    margin: 0 6px 36px;
    border-radius: 99px;
    min-width: 24px;
    transition: background 0.5s ease;
}

.step-line.done { background: var(--success); }


/* ── MAIN CONTENT ────────────────────────── */
.main {
    flex: 1;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    padding: 20px 16px 40px;
}


/* ── CARD ────────────────────────────────── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 20px;
    animation: fade-in 0.35s ease;
}


/* ── DROP ZONE ───────────────────────────── */
.drop-zone {
    border: 3px dashed var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 44px 24px 36px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbff;
    position: relative;
    outline: none;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.active {
    border-color: var(--primary);
    background: var(--primary-bg);
    transform: scale(1.015);
    box-shadow: 0 0 0 4px rgba(79,70,229,0.12);
}

.drop-icon {
    font-size: 4.5rem;
    display: block;
    margin-bottom: 14px;
    animation: float 3.5s ease-in-out infinite;
    line-height: 1;
}

.drop-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    font-family: var(--font-deva);
}

.drop-sub {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 22px;
}

#fileInput { display: none; }

.btn-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 15px 36px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-deva);
    box-shadow: 0 4px 18px rgba(79,70,229,0.38);
    transition: all 0.25s ease;
    white-space: nowrap;
}

.btn-select:hover  { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 7px 24px rgba(79,70,229,0.45); }
.btn-select:active { transform: translateY(0); }

.drop-hint {
    margin-top: 18px;
    font-size: 0.85rem;
    color: #94a3b8;
}


/* ── PREVIEW GRID ────────────────────────── */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    margin-top: 26px;
}

.preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #f1f5f9;
    box-shadow: 0 2px 10px rgba(0,0,0,0.10);
    transition: transform 0.2s, box-shadow 0.2s;
}

.preview-item:hover { transform: scale(1.04); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-name {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    color: white;
    font-size: 0.7rem;
    padding: 12px 6px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remove-btn {
    position: absolute;
    top: 6px; right: 6px;
    width: 28px; height: 28px;
    background: rgba(239,68,68,0.88);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    backdrop-filter: blur(4px);
}

.preview-item:hover .remove-btn,
.remove-btn:focus    { opacity: 1; }
.remove-btn:hover    { transform: scale(1.15); }


/* ── ACTION BAR ──────────────────────────── */
.action-bar {
    margin-top: 20px;
    text-align: center;
}

.file-count {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    font-family: var(--font-deva);
}

.btn-convert {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 440px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 22px 44px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-deva);
    box-shadow: 0 6px 28px rgba(79,70,229,0.42);
    transition: all 0.3s ease;
    letter-spacing: 0.01em;
}

.btn-convert:hover  { transform: translateY(-3px); box-shadow: 0 12px 36px rgba(79,70,229,0.52); }
.btn-convert:active { transform: translateY(-1px); }

.btn-icon { font-size: 1.5rem; }


/* ── PROCESSING ──────────────────────────── */
.card-progress {
    text-align: center;
    padding: 60px 32px;
}

.progress-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 72px;
    height: 72px;
    border: 7px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

.progress-title {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text);
    font-family: var(--font-deva);
}

.progress-sub {
    font-size: 1rem;
    color: var(--text-muted);
    font-family: var(--font-deva);
    line-height: 1.9;
    text-align: center;
}

.progress-track {
    width: 100%;
    max-width: 380px;
    height: 10px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--primary), #a78bfa, #06b6d4);
    background-size: 200% 100%;
    animation: progress-slide 1.6s ease-in-out infinite;
}

@keyframes progress-slide {
    0%   { width: 0%;   margin-left: 0%;    background-position: 0% 50%; }
    50%  { width: 65%;  margin-left: 17%;   background-position: 100% 50%; }
    100% { width: 0%;   margin-left: 100%;  background-position: 0% 50%; }
}


/* ── RESULT ──────────────────────────────── */
.card-result {
    text-align: center;
    padding: 56px 32px;
    background: linear-gradient(160deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 2px solid #bbf7d0;
    animation: slide-up 0.5s ease;
}

.result-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.result-icon {
    font-size: 5.5rem;
    line-height: 1;
    animation: pop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.4);
}

.result-title {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--success-dark);
    font-family: var(--font-deva);
}

.result-sub {
    font-size: 1rem;
    color: #047857;
    font-family: var(--font-deva);
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: 400px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    padding: 22px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 6px 28px rgba(16,185,129,0.42);
    font-family: var(--font-deva);
    line-height: 1.35;
}

.btn-download:hover  { transform: translateY(-3px); box-shadow: 0 12px 36px rgba(16,185,129,0.52); }
.btn-download:active { transform: translateY(-1px); }

.btn-dl-icon { font-size: 1.6rem; flex-shrink: 0; }

.btn-download small {
    font-size: 0.9rem;
    font-weight: 400;
    display: block;
    opacity: 0.88;
}

.btn-again {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-muted);
    border-radius: 50px;
    padding: 13px 30px;
    font-size: 1rem;
    cursor: pointer;
    font-family: var(--font-deva);
    transition: all 0.25s ease;
}

.btn-again:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}


/* ── ERROR LIST ──────────────────────────── */
.error-list {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin-top: 8px;
}

.error-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    font-size: 0.95rem;
    color: #dc2626;
    border-bottom: 1px solid #fee2e2;
    font-family: var(--font-deva);
}

.error-item:last-child { border-bottom: none; }


/* ── STICKY CONVERT BAR ─────────────────── */
/* Always fixed at bottom — full-width on mobile, compact pill on desktop */
.sticky-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: auto;
    padding: 0;
    animation: slide-from-bottom 0.3s ease;
    pointer-events: auto;
}

.sticky-bar .btn-convert {
    width: auto;
    min-width: 320px;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(79, 70, 229, 0.55);
}

/* push page content so the bar never covers the last card */
.page { padding-bottom: 110px; }

/* Mobile: stretch to nearly full width */
@media (max-width: 768px) {
    .sticky-bar {
        bottom: 0;
        left: 0; right: 0;
        transform: none;
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 24px rgba(79, 70, 229, 0.12);
        animation: slide-from-bottom-mobile 0.3s ease;
    }

    .sticky-bar .btn-convert {
        min-width: unset;
        max-width: 100%;
        width: 100%;
    }
}

@keyframes slide-from-bottom {
    from { transform: translateX(-50%) translateY(40px); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

@keyframes slide-from-bottom-mobile {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── FOOTER ──────────────────────────────── */
.footer {
    text-align: center;
    padding: 28px 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: var(--font-deva);
}


/* ── ANIMATIONS ──────────────────────────── */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-7px); }
}

@keyframes bounce-x {
    0%, 100% { transform: translateX(0); }
    50%       { transform: translateX(7px); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pop {
    0%   { transform: scale(0) rotate(-15deg); }
    70%  { transform: scale(1.15) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}


/* ── RESPONSIVE — TABLET (≤768px) ───────── */
@media (max-width: 768px) {
    .hero { padding: 28px 20px 48px; }
    .card { padding: 24px 20px; }
    .drop-zone { padding: 36px 16px 28px; }
    .btn-convert { font-size: 1.2rem; padding: 20px 32px; }
    .btn-download { font-size: 1.1rem; padding: 20px 32px; }
    .preview-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
}


/* ── RESPONSIVE — MOBILE (≤480px) ───────── */
@media (max-width: 480px) {
    body { font-size: 17px; }

    .hero { padding: 24px 16px 42px; }
    .hero-title { font-size: 1.9rem; }
    .logo-icon { font-size: 3rem; }
    .logo { gap: 12px; }
    .hero-desc { font-size: 0.95rem; }

    .steps { padding: 20px 10px 2px; }
    .step-num { width: 44px; height: 44px; font-size: 1.1rem; }
    .step-label { font-size: 0.76rem; }
    .step-label small { font-size: 0.7rem; }
    .step-line { min-width: 16px; margin: 0 4px 34px; }

    .main { padding: 14px 12px 32px; }
    .card { padding: 20px 16px; border-radius: 20px; }
    .drop-zone { padding: 30px 14px 24px; border-radius: 14px; }
    .drop-icon { font-size: 3.5rem; }
    .drop-title { font-size: 1.3rem; }
    .drop-sub { font-size: 0.95rem; margin-bottom: 18px; }
    .btn-select { font-size: 1.05rem; padding: 14px 26px; }

    .preview-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }

    .btn-convert { font-size: 1.1rem; padding: 18px 24px; max-width: 100%; }

    .card-progress { padding: 44px 20px; }
    .progress-title { font-size: 1.4rem; }
    .spinner { width: 60px; height: 60px; }

    .card-result { padding: 44px 20px; }
    .result-icon { font-size: 4.5rem; }
    .result-title { font-size: 1.7rem; }
    .btn-download { font-size: 1.05rem; padding: 18px 24px; max-width: 100%; }
    .btn-again { font-size: 0.95rem; padding: 12px 22px; }
}


/* ── REDUCED MOTION (accessibility) ─────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
