/* =========================================
   LAYLINK CONVERT - STANDALONE PAGE v2
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #ee4d2d;
    --primary-dark: #d73211;
    --primary-light: #fff1ed;
    --accent: #f97316;
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --text: #222222;
    --text-muted: #888888;
    --border: #e8e8e8;
    --success: #27ae60;
    --success-light: #e8f8f0;
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* === HEADER === */
.header {
    width: 100%;
    background: #ffffff;
    padding: 28px 20px 24px;
    text-align: center;
    position: relative;
    border-bottom: 2px solid #f0f0f0;
}

.header-icon {
    display: inline-block;
    background: var(--primary-light);
    padding: 8px 16px;
    border-radius: 50px;
    margin-bottom: 12px;
}

.header-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.header-sub {
    font-size: 14px;
    font-weight: 500;
    color: #666666;
    line-height: 1.5;
}

.header-sub strong,
.header-sub span {
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    color: var(--primary);
}

/* === MAIN === */
.main-container {
    width: 100%;
    max-width: 480px;
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* === CARD === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

/* === INPUT === */
.input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.link-input {
    width: 100%;
    height: 48px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 0 48px 0 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: white;
    transition: border-color 0.2s;
    outline: none;
}

.link-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(238, 77, 45, 0.1);
}

.link-input::placeholder {
    color: #bbb;
}

.btn-paste {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-paste:hover {
    background: #ffddd5;
}

/* === CONVERT BUTTON === */
.btn-convert {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, #ee4d2d, #f97316);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-convert:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(238, 77, 45, 0.35);
}

.btn-convert:active {
    transform: scale(0.98);
}

.btn-convert:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    animation: none;
}

/* Pulse glow animation */
.btn-pulse {
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(238, 77, 45, 0.4);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(238, 77, 45, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(238, 77, 45, 0);
    }
}

/* === RESULT === */
.result-section {
    display: none;
    animation: slideIn 0.4s ease;
}

.result-section.show {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-info {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.product-thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: #f9f9f9;
}

.product-detail {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.badge-success {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--success-light);
    color: var(--success);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

/* === COPY === */
.btn-copy {
    width: 100%;
    height: 46px;
    background: var(--primary-light);
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-copy:hover {
    background: #ffddd5;
    transform: translateY(-1px);
}

.btn-copy:active {
    transform: scale(0.98);
}

.btn-copy.copied {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}

/* === FACEBOOK BUTTON === */
.btn-fb {
    height: 46px;
    background: #1877f2;
    color: white;
    border: 2px solid #1877f2;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}

.btn-fb:hover {
    background: #166fe5;
    transform: translateY(-1px);
}

.btn-fb:active {
    transform: scale(0.98);
}

/* === GUIDE === */
.guide-section {
    background: #fffbf0;
    border: 1px dashed #fbbf24;
    border-radius: var(--radius);
    padding: 14px;
}

.guide-title {
    font-size: 13px;
    font-weight: 700;
    color: #b45309;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.guide-text {
    font-size: 12px;
    color: #92400e;
    line-height: 1.6;
    margin-bottom: 10px;
}

.guide-text b,
.guide-text strong {
    color: var(--primary);
}

.guide-link {
    display: block;
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
    word-break: break-all;
    margin-bottom: 8px;
}

.guide-link:hover {
    text-decoration: underline;
}

/* === LOADING === */
.spinner {
    display: none;
    justify-content: center;
    padding: 16px 0;
}

.spinner.show {
    display: flex;
}

.spinner-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--primary);
    margin: 0 3px;
    animation: bounce 1.4s infinite both;
}

.spinner-dot:nth-child(2) {
    animation-delay: 0.16s;
}

.spinner-dot:nth-child(3) {
    animation-delay: 0.32s;
}

/* === ERROR === */
.error-msg {
    display: none;
    text-align: center;
    color: #dc2626;
    font-size: 12px;
    padding: 8px;
    background: #fef2f2;
    border-radius: 8px;
    margin-top: 10px;
}

.error-msg.show {
    display: block;
}

/* === FOOTER === */
.footer {
    padding: 16px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
}

/* === ANIMATIONS === */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0)
    }

    40% {
        transform: scale(1)
    }
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s;
    z-index: 999;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .header {
        padding: 24px 16px 20px;
        border-radius: 0 0 16px 16px;
    }

    .header-title {
        font-size: 20px;
        letter-spacing: -0.4px;
    }

    .header-sub {
        font-size: 13px;
    }

    .main-container {
        padding: 14px;
        max-width: 100%;
    }

    .card {
        padding: 16px;
    }

    .link-input {
        font-size: 16px;
        /* Prevents zoom on iOS */
        height: 52px;
    }

    .btn-convert {
        height: 52px;
        font-size: 15px;
    }
}

@media (max-width: 360px) {
    .header {
        padding: 20px 12px 16px;
    }

    .header-title {
        font-size: 18px;
    }

    .header-sub {
        font-size: 12px;
    }

    .card {
        padding: 14px;
    }
}

/* === HEADER ROW (Logo + Title inline) === */
.header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
}

.header-logo {
    height: 22px;
    flex-shrink: 0;
}

/* === GUIDE SECTION (CTA Banner) === */
.guide-section {
    background: #fff8f5;
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 0;
    margin-top: 10px;
    text-align: left;
    overflow: hidden;
}

.guide-title {
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 18px;
    letter-spacing: 0.02em;
}

.guide-fb-link {
    display: block;
    color: #1877f2;
    font-size: 13px;
    font-weight: 600;
    word-break: break-all;
    text-decoration: none;
    margin: 4px 18px 8px 36px;
}

.guide-fb-link:hover {
    text-decoration: underline;
}

/* === GUIDE STEPS === */
.guide-steps {
    text-align: left;
    margin-bottom: 10px;
}

.guide-step {
    font-size: 14px;
    color: #444;
    line-height: 2;
    padding: 0 18px;
}

/* === VOUCHER PREVIEW IMAGE === */
.voucher-preview {
    width: calc(100% - 36px);
    max-width: 400px;
    border-radius: 10px;
    margin: 8px 18px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}