/* =========================================
   SANSALE — Domain-based Bio Page
   Extracted & enhanced from fb/index.html
   ========================================= */
:root {
    --primary: #ee4d2d;
    --primary-dark: #d73211;
    --primary-light: #fff1ed;
    --accent: #f97316;
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --text: #222222;
    --text-muted: #888888;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border: #e8e8e8;
    --border-card: #e8e8e8;
    --success: #27ae60;
    --success-light: #e8f8f0;
    --input-bg: #fafafa;
    --input-border: #e0e0e0;
    --radius: 12px;
    --radius-card: 12px;
    --radius-input: 10px;
    --radius-btn: 10px;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);
}

* {
    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;
}

/* === DARK MODE === */
body.dark {
    --bg: #0f0f14;
    --bg-card: #1a1a22;
    --text: #e8e8ed;
    --text-muted: #888;
    --text-secondary: #a0a0a8;
    --text-tertiary: #666;
    --border: #2a2a35;
    --border-card: #2a2a35;
    --input-bg: #22222d;
    --input-border: #333340;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2);
    --primary-light: rgba(238, 77, 45, 0.12);
    --success-light: rgba(39, 174, 96, 0.12);
}

/* === HEADER === */
.header {
    width: 100%;
    background: var(--bg-card);
    padding: 28px 20px 24px;
    text-align: center;
    position: relative;
    border-bottom: 2px solid var(--border);
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
}

.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: var(--text-secondary);
    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-card);
    border-radius: var(--radius-card);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

/* === INPUT === */
.input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.link-input {
    width: 100%;
    height: 48px;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-input);
    padding: 0 48px 0 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--input-bg);
    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: var(--text-tertiary);
}

.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;
}

body.dark .btn-paste:hover {
    background: rgba(238, 77, 45, 0.25);
}

.pub-input-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-tertiary);
    padding: 0 4px;
}

/* === CONVERT BUTTON === */
.btn-convert {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, #ee4d2d, #f97316);
    color: white;
    border: none;
    border-radius: var(--radius);
    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;
}

.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: var(--input-bg);
}

.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: var(--radius-btn);
    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;
    font-family: inherit;
}

.btn-copy:hover {
    background: #ffddd5;
    transform: translateY(-1px);
}

body.dark .btn-copy:hover {
    background: rgba(238, 77, 45, 0.2);
}

.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: var(--radius-btn);
    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 SECTION === */
.guide-section {
    background: #fff8f5;
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 0;
    margin-top: 10px;
    text-align: left;
    overflow: hidden;
}

body.dark .guide-section {
    background: rgba(238, 77, 45, 0.06);
    border-color: rgba(238, 77, 45, 0.3);
}

.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-step {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 2;
    padding: 0 18px;
}

.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;
}

/* === LOADING / ERROR / SETUP === */
.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-msg {
    display: none;
    text-align: center;
    color: #dc2626;
    font-size: 12px;
    padding: 8px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 8px;
    margin-top: 10px;
}

body.dark .error-msg {
    background: rgba(248, 113, 113, 0.10);
    color: #F87171;
}

.error-msg.show {
    display: block;
}

.pub-setup-note {
    display: none;
    padding: 14px 16px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.18);
    border-radius: var(--radius-card);
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

body.dark .pub-setup-note {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.12);
}

.pub-setup-note .setup-title {
    font-weight: 700;
    font-size: 13px;
    color: #d97706;
    margin-bottom: 6px;
}

body.dark .pub-setup-note .setup-title {
    color: #fbbf24;
}

.pub-setup-note ol {
    margin: 6px 0 0;
    padding-left: 18px;
}

.pub-setup-note ol li {
    margin-bottom: 3px;
}

.pub-setup-note a {
    color: var(--primary);
    font-weight: 600;
}

/* === SOCIAL / CONTACT === */
.pub-social-card {
    padding: 16px;
    text-align: center;
}

.pub-social-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pub-social-icons-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

.pub-social-icon-btn {
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    background: #ffffff;
    border: 1px solid var(--primary);
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.pub-social-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    background: #f0f5ff;
}

body.dark .pub-social-icon-btn {
    background: var(--bg-card);
}

body.dark .pub-social-icon-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}

.pub-social-btn-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pub-social-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    border: 1.5px solid currentColor;
}

.pub-social-chevron {
    color: var(--text-tertiary);
    font-size: 13px;
    transition: transform 0.2s ease;
}

.pub-social-icon-btn:hover .pub-social-chevron {
    transform: translateX(4px);
    color: currentColor;
}

/* Social button variants */
.pub-social-icon-btn.fb { border-color: #1877f2; color: #1877f2; }
.pub-social-icon-btn.fb .pub-social-icon-circle { background: transparent; color: #1877f2; border: 1.5px solid currentColor; }
.pub-social-icon-btn.fb:hover { background: #f0f5ff; }

.pub-social-icon-btn.zalo { border-color: #0068FF; color: #0068FF; }
.pub-social-icon-btn.zalo .pub-social-icon-circle { background: transparent; color: #0068FF; border: 1.5px solid currentColor; }
.pub-social-icon-btn.zalo:hover { background: #f0f7ff; }

.pub-social-icon-btn.tiktok { border-color: #111; color: #111; }
.pub-social-icon-btn.tiktok .pub-social-icon-circle { background: transparent; color: #111; border: 1.5px solid currentColor; }
.pub-social-icon-btn.tiktok:hover { background: #f8f8f8; }
body.dark .pub-social-icon-btn.tiktok { border-color: #eee; color: #eee; }
body.dark .pub-social-icon-btn.tiktok .pub-social-icon-circle { background: transparent; color: #eee; }
body.dark .pub-social-icon-btn.tiktok:hover { background: rgba(255, 255, 255, 0.05); }

.pub-social-icon-btn.youtube { border-color: #ff0000; color: #ff0000; }
.pub-social-icon-btn.youtube .pub-social-icon-circle { background: transparent; color: #ff0000; border: 1.5px solid currentColor; }
.pub-social-icon-btn.youtube:hover { background: #fff0f0; }

.pub-social-icon-btn.instagram { border-color: #E4405F; color: #E4405F; }
.pub-social-icon-btn.instagram .pub-social-icon-circle { background: #E4405F; color: #fff; border: none; }
.pub-social-icon-btn.instagram:hover { background: #fad1da; }

.pub-social-icon-btn.telegram { background: #e8f4fa; color: #0088cc; }
.pub-social-icon-btn.telegram .pub-social-icon-circle { background: #0088cc; color: #fff; border: none; }
.pub-social-icon-btn.telegram:hover { background: #d1eafa; }

.pub-social-icon-btn.phone { background: #e8f5ec; color: #16a34a; }
.pub-social-icon-btn.phone .pub-social-icon-circle { background: #16a34a; color: #fff; border: none; }
.pub-social-icon-btn.phone:hover { background: #d1ebd8; }

.pub-social-icon-btn.contact { background: var(--input-bg); color: var(--text); border: 1px solid var(--border-card); }
.pub-social-icon-btn.contact .pub-social-icon-circle { background: var(--text); color: var(--bg-card); border: none; }
.pub-social-icon-btn.contact:hover { background: var(--border-card); }

.pub-social-tagline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.pub-social-tagline span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.pub-social-tagline .sep {
    color: var(--border-card);
    font-size: 10px;
}

/* === TIPS SECTION (Collapsible) === */
.pub-tips-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    font-family: inherit;
    text-align: left;
    transition: all 0.15s ease;
}

.pub-tips-toggle .chevron {
    margin-left: auto;
    font-size: 11px;
    transition: transform 0.25s ease;
    color: var(--text-tertiary);
}

.pub-tips-toggle.open .chevron {
    transform: rotate(180deg);
}

.pub-tips-body {
    display: none;
    padding: 0 16px 16px;
    animation: slideIn 0.3s ease both;
}

.pub-tips-body.show {
    display: block;
}

.tips-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 16px 0 10px;
}

.tips-section-label:first-child {
    margin-top: 0;
}

.tips-time-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.tips-time-icon { font-size: 22px; }

.tips-time-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.tips-time-badges {
    display: flex;
    gap: 6px;
}

.tips-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.10);
    color: #16a34a;
}

body.dark .tips-badge {
    background: rgba(34, 197, 94, 0.08);
    color: #4ade80;
}

.tips-alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.tips-alert.warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.18);
}

.tips-alert-head {
    font-weight: 700;
    margin-bottom: 4px;
}

.tips-alert.warning .tips-alert-head { color: #d97706; }
body.dark .tips-alert.warning .tips-alert-head { color: #fbbf24; }

.tips-alert .red {
    color: #ef4444;
    font-weight: 600;
}

.tips-step {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    margin-bottom: 10px;
}

.tips-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
}

body.dark .tips-step-num { color: #121218; }

.tips-step-body {
    flex: 1;
    min-width: 0;
}

.tips-step-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.tips-step-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tips-step-tip {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(245, 158, 11, 0.06);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tips-bonus {
    padding: 12px 14px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.tips-bonus-head {
    font-weight: 700;
    color: #6366f1;
    margin-bottom: 4px;
}

/* === LOADING / 404 === */
.pub-loading,
.pub-404 {
    display: none;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-tertiary);
}



/* === 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;
}

/* === THEME TOGGLE === */
.theme-float {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    transform: scale(1.1);
}

/* === ANIMATIONS === */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* === SKELETON LOADING === */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--input-bg) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-header {
    width: 60%;
    height: 28px;
    margin: 0 auto 12px;
}

.skeleton-sub {
    width: 80%;
    height: 16px;
    margin: 0 auto;
}

.skeleton-input {
    width: 100%;
    height: 48px;
    margin-bottom: 16px;
}

.skeleton-btn {
    width: 100%;
    height: 50px;
}

/* === 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;
        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; }
}
