/* ============================================================
 * SetiTagila Info — Corporate PWA Styles
 * ============================================================
 * Primary accent: #b72c43
 * Dark corporate theme with glassmorphism elements
 * ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    --accent:          #b72c43;
    --accent-light:    #d4435c;
    --accent-dark:     #8e1f33;
    --accent-glow:     rgba(183, 44, 67, 0.35);

    --bg-page:         #0f1117;
    --bg-card:         rgba(255, 255, 255, 0.04);
    --bg-card-hover:   rgba(255, 255, 255, 0.07);
    --border-card:     rgba(255, 255, 255, 0.08);

    --input-bg:        rgba(255, 255, 255, 0.06);
    --input-border:    rgba(255, 255, 255, 0.12);

    --text-primary:    #e8eaed;
    --text-secondary:  #9aa0a6;
    --text-muted:      #5f6368;

    --success:         #34d399;
    --error:           #f87171;
    --warning:         #fbbf24;

    --radius-lg:       20px;
    --radius-md:       14px;
    --radius-sm:       10px;

    --transition:      0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-page:         #f0f2f5;
        --bg-card:         rgba(255, 255, 255, 0.85);
        --bg-card-hover:   rgba(255, 255, 255, 1);
        --border-card:     rgba(0, 0, 0, 0.08);

        --input-bg:        rgba(0, 0, 0, 0.04);
        --input-border:    rgba(0, 0, 0, 0.15);

        --text-primary:    #111827;
        --text-secondary:  #4b5563;
        --text-muted:      #9ca3af;

        --success:         #059669;
        --error:           #dc2626;
        --warning:         #d97706;

        --accent-glow:     rgba(183, 44, 67, 0.15);
    }
}

/* ── Reset & Base ──────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow-x: hidden;
}

/* ── Animated background accent ──────────────────────────── */
body::before {
    content: '';
    position: fixed;
    top: -40%;
    left: -20%;
    width: 80vw;
    height: 80vw;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 8s ease-in-out infinite alternate;
}

body::after {
    content: '';
    position: fixed;
    bottom: -30%;
    right: -15%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(183, 44, 67, 0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 10s ease-in-out 2s infinite alternate-reverse;
}

@keyframes bgPulse {
    0%   { transform: scale(1)   translate(0, 0); }
    100% { transform: scale(1.1) translate(3%, 3%); }
}

/* ── Main Container ──────────────────────────────────────── */
.app-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    animation: fadeSlideUp 0.6s ease-out both;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Card ────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 24px 48px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Logo & Brand ────────────────────────────────────────── */
.brand {
    margin-bottom: 2rem;
}

.brand-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px var(--accent-glow);
    position: relative;
}

.brand-icon::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: calc(var(--radius-md) + 2px);
    background: linear-gradient(135deg, var(--accent-light), transparent, var(--accent-dark));
    z-index: -1;
    opacity: 0.5;
}

.brand-icon svg {
    width: 32px;
    height: 32px;
    fill: #fff;
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand h1 span {
    color: var(--accent);
}

.brand-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 0.75rem;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-card), transparent);
    margin: 1.5rem 0;
}

/* ── Status Area ─────────────────────────────────────────── */
.status-area {
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-message {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
    line-height: 1.4;
}

.status-message:not(:empty) {
    margin-bottom: 1.5rem;
}

.status-message:empty {
    display: none !important;
}

.status-message--loading {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.status-message--success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.2);
    color: var(--success);
}

.status-message--error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--error);
}

.status-message--subscribed {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.15);
    color: var(--success);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Primary Button ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.95rem 1.5rem;
    font-family: inherit;
    font-size: 0.925rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition:
        background var(--transition),
        transform var(--transition-fast),
        box-shadow var(--transition);
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn--primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn--primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
    box-shadow: 0 8px 28px var(--accent-glow);
    transform: translateY(-1px);
}

.btn--primary:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px var(--accent-glow);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ── Footer ──────────────────────────────────────────────── */
.card-footer {
    margin-top: 1.75rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* ── Inputs ──────────────────────────────────────────────── */
.input-group {
    margin-bottom: 1rem;
}

.input-group input {
    width: 100%;
    padding: 0.95rem 1.25rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group input:focus {
    border-color: var(--accent);
    background: transparent;
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ── Hidden utility ──────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
    body {
        padding: 1rem;
        height: 100%;
        min-height: 100dvh;
        align-items: center; 
        justify-content: center;
    }
    
    /* When keyboard is detected via JS */
    body.keyboard-visible {
        align-items: center; /* Still center, but we shift the card */
    }

    body.keyboard-visible .card {
        transform: translateY(-20vh); /* Shift up significantly */
    }

    .card {
        padding: 1.5rem 1.25rem;
        width: 100%;
        margin: 0;
    }

    .brand-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 1rem;
    }
    
    .brand-icon svg {
        width: 24px;
        height: 24px;
    }

    .brand h1 {
        font-size: 1.25rem;
    }
    
    .brand-description {
        font-size: 0.8rem;
        margin-top: 0.5rem;
    }
    
    .divider {
        margin: 1rem 0;
    }
}

/* ── PWA Install Instructions ────────────────────────────── */
.install-instructions {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    width: 100%;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    text-align: left;
    color: var(--text-primary);
}

.ios-instruction-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ios-instruction-step:last-child {
    margin-bottom: 0;
}

.ios-icon-box {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ios-icon-box svg {
    width: 20px;
    height: 20px;
}

.ios-icon-box.share svg { fill: #007aff; }
.ios-icon-box.add svg { fill: var(--text-primary); }
