:root {
    --bg: #0f0f12;
    --card: #1a1a1f;
    --border: #2d2d35;
    --text: #e4e4e7;
    --text-muted: #a1a1aa;
    --accent: #ec4899;
    --accent-hover: #f472b6;
    --success: #22c55e;
    --input-bg: #27272a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 24px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #3d3d45;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg);
}

.container {
    max-width: 680px;
    margin: 0 auto;
}

/* Global login overlay - ở giữa màn hình */
.global-login-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.global-login-message {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.5rem;
    color: var(--text);
    text-align: center;
    max-width: 400px;
    line-height: 1.6;
    padding: 24px 32px;
    background: rgba(26, 26, 31, 0.95);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
@media (max-width: 599px) {
    .global-login-message {
        font-size: 1.125rem;
    }
}

/* Form content wrapper - trạng thái chưa đăng nhập */
.form-content-wrapper.form-login-required {
    opacity: 0.06;
    pointer-events: none;
    user-select: none;
}

/* Chặn scroll form khi chưa đăng nhập
body.auth-required-no-scroll {
    overflow: hidden;
} */

/* Pricing sidebar - trạng thái chưa đăng nhập */
.pricing-sidebar.pricing-sidebar-login-required {
    opacity: 0.06;
    pointer-events: none;
    user-select: none;
}

/* Desktop: Bảng giá sticky bên trái */
@media (min-width: 1200px) {
    body {
        padding-left: 340px;
    }
    .pricing-sidebar {
        position: fixed;
        left: 20px;
        top: 20px;
        width: 300px;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        z-index: 100;
    }
    .pricing-sidebar .section {
        margin-bottom: 0;
    }
    /* Ẩn bảng giá trong form trên desktop */
    #pricingSectionInForm {
        display: none;
    }
}
@media (max-width: 1199px) {
    /* Ẩn sidebar trên mobile/tablet */
    .pricing-sidebar {
        display: none;
    }
}

header {
    text-align: center;
    margin-bottom: 32px;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

.section {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tiêu đề + bật/tắt cùng hàng */
.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0;
}

.section-header-row .section-title {
    margin-bottom: 0;
}

/* Toggle switch (nút bật/tắt) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    transition: background 0.2s, box-shadow 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(22px);
}

.toggle-switch input:focus-visible+.toggle-slider {
    box-shadow: 0 0 0 2px var(--accent);
}

.section-content-toggle {
    margin-top: 16px;
}

.section-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.step-badge {
    background: var(--accent);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.label-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.875rem;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a1a1aa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.row-2-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        max-width: 100%;
    }

    header {
        margin-bottom: 20px;
    }

    h1 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .section {
        padding: 16px;
        margin-bottom: 12px;
    }

    .section-title {
        font-size: 0.95rem;
    }

    .section-desc {
        font-size: 0.75rem;
    }

    .form-group {
        margin-bottom: 12px;
    }

    input[type="text"],
    input[type="password"],
    textarea,
    select {
        padding: 10px;
        font-size: 16px;
        /* Tránh zoom trên iOS */
    }

    .btn {
        padding: 10px 14px;
        font-size: 0.875rem;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn {
        width: 100%;
    }

    .row-2 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .row-2-inline {
        grid-template-columns: 1fr 1fr;
    }

    .heart-mode-options {
        flex-direction: column;
        gap: 8px;
    }

    .heart-mode-btn {
        width: 100%;
    }

    .theme-preview {
        flex-direction: column;
    }

    .theme-option {
        width: 100%;
    }

    .letter-type-options {
        flex-direction: column;
    }

    .letter-type-btn {
        width: 100%;
    }

    .letter-type-wrapper .form-group {
        margin-bottom: 0;
        width: 100%;
    }

    .letter-preview-image {
        width: 100% !important;
        max-width: 220px !important;
        margin: 0 auto;
    }

    .letter-preview-image img {
        max-height: 200px !important;
        object-fit: contain;
    }


    .sphere-image-card .index-badge {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
        top: 4px;
        left: 4px;
    }

    .sphere-image-overlay .btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .title-preview-tooltip {
        width: 200px;
        max-width: calc(100vw - 40px);
    }

    .chat-preview-mini-screen {
        max-width: 100%;
    }

    .heart-preview-wrap {
        padding: 12px;
    }

    .heart-preview-inner {
        gap: 12px;
    }

    .heart-preview-sides {
        gap: 16px;
    }

    .heart-preview-side-img {
        width: 40px;
        height: 40px;
    }

    .heart-preview-name {
        max-width: 60px;
    }

    .music-player {
        flex-direction: column;
        align-items: stretch;
    }

    .music-player-btn {
        width: 100%;
        height: 44px;
        border-radius: 8px;
    }

    .music-input-row {
        flex-direction: column;
        gap: 8px;
    }

    .music-input-row .btn {
        width: 100%;
    }
}

@media (max-width: 500px) {
    .row-2 {
        grid-template-columns: 1fr;
    }

    .row-2-inline {
        grid-template-columns: 1fr 1fr;
    }
}

.message-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: flex-start;
}

.message-item textarea {
    flex: 1;
    min-height: 60px;
}

.message-item .order-num {
    width: 28px;
    height: 28px;
    background: var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--border);
    color: var(--text);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

.btn-add {
    background: var(--accent);
    color: white;
}

.btn-add:hover {
    background: var(--accent-hover);
}

.img-url-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.img-url-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.img-url-row input {
    flex: 1;
    min-width: 0;
}

.theme-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.theme-option {
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}

.theme-option:hover {
    border-color: var(--accent);
}

.theme-option.selected {
    border-color: var(--accent);
    background: rgba(236, 72, 153, 0.1);
}

.theme-option .name {
    font-weight: 500;
}

.theme-option .preview-bar {
    height: 4px;
    border-radius: 2px;
    margin-top: 6px;
}

.heart-mode-options {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.heart-mode-btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.heart-mode-btn:hover {
    border-color: var(--accent);
}

.heart-mode-btn.selected {
    border-color: var(--accent);
    background: rgba(236, 72, 153, 0.1);
}

.heart-mode-btn .title {
    font-weight: 600;
    font-size: 0.9rem;
}

.heart-mode-btn .desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.heart-days-sub-options {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.heart-days-sub-btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.heart-days-sub-btn:hover {
    border-color: var(--accent);
}

.heart-days-sub-btn.selected {
    border-color: var(--accent);
    background: rgba(236, 72, 153, 0.1);
}

.heart-days-sub-btn .title {
    font-weight: 600;
    font-size: 0.9rem;
}

.heart-days-sub-btn .desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.expiration-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.expiration-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.expiration-btn:hover {
    border-color: var(--accent);
}

.expiration-btn.selected {
    border-color: var(--accent);
    background: rgba(236, 72, 153, 0.1);
}

.expiration-btn .title {
    font-weight: 600;
    font-size: 0.9rem;
}

.expiration-btn .desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pricing-table {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 12px;
}

.pricing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.pricing-row:last-child {
    border-bottom: none;
}

.pricing-row.inactive {
    color: var(--text-muted, #6b7280);
}

.pricing-row .price {
    font-weight: 600;
    color: var(--accent);
}

.pricing-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: rgba(236, 72, 153, 0.08);
    font-weight: 700;
    font-size: 1.1rem;
}

.pricing-total .price {
    color: var(--accent);
    font-size: 1.25rem;
}

.pricing-row-tip .pricing-tip-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pricing-row-tip input#tipAmount {
    width: 100px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: right;
    font-weight: 600;
    color: var(--accent);
}
.pricing-row-tip input#tipAmount.input-error {
    border-color: #ef4444;
    outline: 1px solid #ef4444;
}

.section-tip-voucher {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.tip-voucher-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 640px) {
    .tip-voucher-grid { grid-template-columns: 1fr; }
}
.tip-voucher-card {
    padding: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.tip-voucher-card .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tip-voucher-card .card-title span:first-child { font-size: 1.1rem; }
.section-tip-voucher input#tipAmount {
    width: 100%;
    max-width: 160px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    text-align: right;
    background: var(--input-bg);
    color: var(--text);
}
.section-tip-voucher input#tipAmount.input-error {
    border-color: #ef4444;
    outline: 1px solid #ef4444;
}
.section-tip-voucher .tip-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}
.tip-voucher-card .voucher-list {
    max-height: 160px;
}
.voucher-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.voucher-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.voucher-item:hover {
    background: rgba(236, 72, 153, 0.06);
    border-color: var(--accent);
}
.voucher-item.selected {
    border-color: var(--accent);
    background: rgba(236, 72, 153, 0.1);
}
.voucher-item .voucher-code { font-weight: 600; color: var(--text); }
.voucher-item .voucher-discount { font-size: 0.875rem; color: var(--accent); }
.voucher-apply-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.voucher-apply-row input {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    background: var(--input-bg);
    color: var(--text);
}
.voucher-message {
    margin-top: 6px;
    font-size: 0.875rem;
    min-height: 1.25em;
}
.voucher-message.success { color: var(--accent); }
.voucher-message.error { color: #ef4444; }

.payment-method-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.payment-method-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
}
.payment-method-item:hover { border-color: rgba(236, 72, 153, 0.5); }
.payment-method-item:has(input:checked) {
    border-color: var(--accent);
    background: rgba(236, 72, 153, 0.08);
}
.payment-method-item input { margin-top: 3px; flex-shrink: 0; }
.payment-method-item .method-info { flex: 1; }
.payment-method-item .method-name { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.payment-method-item .method-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
.payment-method-note { margin-top: 12px; padding: 10px 12px; background: rgba(236, 72, 153, 0.06); border-radius: 8px; font-size: 0.85rem; color: var(--text-muted); }
.payment-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 9999; align-items: center; justify-content: center; padding: 20px; }
.payment-modal-overlay[style*="flex"] { display: flex !important; }
.payment-modal-content { position: relative; background: var(--card); border-radius: 12px; overflow: hidden; max-width: 480px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,0.4); }
.payment-modal-close { position: absolute; top: 8px; right: 12px; z-index: 10; width: 36px; height: 36px; border: none; background: rgba(0,0,0,0.5); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; border-radius: 8px; }

.price-badge {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    margin-left: 6px;
}

.conditional-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.letter-type-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.letter-type-btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.15s;
}

.letter-type-btn:hover {
    border-color: var(--accent);
}

.letter-type-btn.selected {
    border-color: var(--accent);
    background: rgba(236, 72, 153, 0.1);
}

.letter-type-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.letter-type-wrapper .form-group {
    flex: 1;
    margin-bottom: 0;
}

.letter-preview-image {
    flex-shrink: 0;
    width: 300px;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--input-bg);
}

.letter-preview-image img {
    width: 100%;
    height: auto;
    display: block;
}

.actions {
    position: sticky;
    bottom: 0;
    background: var(--bg);
    padding: 20px 0 0;
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.actions-hint {
    margin: 8px 0 0;
    font-size: 0.875rem;
    color: var(--muted, #6b7280);
    width: 100%;
}

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.avatar-preview {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    margin-top: 8px;
}

.input-with-file-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-with-file-row input {
    flex: 1;
    min-width: 0;
}

.sphere-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Grid ảnh quả cầu - preview thay vì link */
.sphere-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.sphere-image-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--input-bg);
}

.sphere-image-card:hover .sphere-image-overlay,
.sphere-image-card.show-overlay .sphere-image-overlay {
    opacity: 1;
    pointer-events: auto;
}

.sphere-image-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sphere-image-thumb.placeholder {
    object-fit: none;
    opacity: 0.4;
    background: var(--border);
    min-height: 100%;
}

.sphere-image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.sphere-image-card .sphere-image-overlay .btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    touch-action: manipulation;
}

.sphere-image-card .sphere-image-overlay .btn-remove {
    background: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.sphere-image-card .sphere-image-overlay .btn-remove:hover {
    background: rgba(239, 68, 68, 0.5);
}

/* Mobile: luôn hiển thị overlay để ấn 1 lần là xóa/đổi được */
@media (hover: none) {
    .sphere-image-card .sphere-image-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}

.sphere-image-card .index-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.sphere-add-card {
    aspect-ratio: 1;
    border-radius: 12px;
    border: 2px dashed var(--border);
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.sphere-add-card:hover {
    border-color: var(--accent);
    background: rgba(236, 72, 153, 0.08);
    color: var(--accent);
}

.sphere-add-card .icon {
    font-size: 1.5rem;
}

.sphere-extra-fee-notice {
    display: block;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(236, 72, 153, 0.12);
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Tooltip hover preview cho title */
.title-with-preview {
    position: relative;
}

.what-is-this {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.75rem;
    color: var(--accent);
    cursor: help;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    transition: color 0.2s;
    position: relative;
}

.what-is-this:hover {
    color: var(--accent-hover);
}

.what-is-this.active {
    color: var(--accent-hover);
}

.title-preview-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    max-width: 90vw;
    padding: 6px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

/* Mobile: tooltip hiển thị ở giữa màn hình */
@media (max-width: 768px) {
    .title-preview-tooltip {
        position: fixed;
        top: 50% !important;
        left: 50% !important;
        bottom: auto !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 85vw;
        max-width: 280px;
        padding: 10px;
        z-index: 10001;
        max-height: 75vh;
        overflow-y: auto;
    }
    
    .title-preview-tooltip::after {
        display: none; /* Ẩn mũi tên trên mobile */
    }
    
    /* Overlay backdrop khi tooltip active */
    .what-is-this.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 10000;
        animation: fadeIn 0.2s;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    /* Tooltip triple trên mobile: hiển thị hàng ngang */
    .title-preview-tooltip.title-preview-tooltip-triple {
        max-width: 95vw;
        width: auto;
    }
    .title-preview-tooltip-triple {
        display: flex;
        flex-direction: row;
        gap: 8px;
        justify-content: center;
    }
    .title-preview-tooltip-triple img {
        width: auto;
        max-width: 28vw;
        height: auto;
        max-height: 220px;
        object-fit: contain;
    }
    
    /* Text hint ở dưới tooltip */
    .title-preview-tooltip::after {
        content: 'Chạm ra ngoài để đóng';
        display: block !important;
        margin-top: 8px;
        text-align: center;
        font-size: 10px;
        color: var(--text-muted);
        opacity: 0.7;
        position: static !important;
        transform: none !important;
        border: none !important;
    }
    
    /* Đảm bảo tooltip có thể scroll nếu nội dung dài (trừ triple - giữ hàng ngang) */
    .title-preview-tooltip:not(.title-preview-tooltip-triple) {
        display: flex;
        flex-direction: column;
    }
}

.what-is-this:hover .title-preview-tooltip,
.what-is-this.active .title-preview-tooltip {
    opacity: 1;
    pointer-events: auto;
}

.title-preview-tooltip img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.title-preview-tooltip-small {
    width: 180px;
}

.title-preview-tooltip-small img {
    max-height: 240px;
    object-fit: contain;
}

.title-preview-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border);
}

/* Tooltip 3 ảnh (demo Messenger: màn khóa, chat, mật khẩu) */
.title-preview-tooltip.title-preview-tooltip-triple {
    width: 340px;
}
.title-preview-tooltip-triple {
    display: flex;
    gap: 8px;
    width: auto;
    max-width: none;
}
.title-preview-tooltip-triple img {
    width: 100px;
    height: auto;
    max-height: 170px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

/* Hướng dẫn thêm vào màn hình chính */
.add-to-home-guide {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.add-to-home-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.4;
}
.add-to-home-platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.add-to-home-trigger {
    font-size: 0.85rem;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.add-to-home-trigger:hover {
    color: var(--accent-hover);
}

/* Toast thông báo lỗi góc trên */
.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 1px #ef4444;
}

/* Nút ảnh khi lỗi - viền đỏ rõ ràng, cách nút một chút */
button.input-error,
.btn.input-error {
    outline: 2px solid #ef4444 !important;
    outline-offset: 3px;
}

#messagesContainer.input-error {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
    border-radius: 8px;
}

#sphereImagesContainer.input-error {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
    border-radius: 8px;
}

.toast-error {
    position: fixed;
    top: 16px;
    right: 16px;
    max-width: 360px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: pre-line;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000000;
    animation: toastSlideIn 0.3s ease-out;
}

.toast-success {
    position: fixed;
    top: 16px;
    right: 16px;
    max-width: 320px;
    padding: 12px 16px;
    background: rgba(34, 197, 94, 0.95);
    color: white;
    border-radius: 8px;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000000;
    animation: toastSlideIn 0.3s ease-out;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.success-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 16px;
}

.success-dialog {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
}

.success-dialog h3 {
    margin: 0 0 16px;
    font-size: 1.25rem;
    color: var(--text);
}

.success-dialog .url-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.875rem;
    word-break: break-all;
    color: var(--accent);
    margin-bottom: 16px;
}

.success-dialog .dialog-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}
.success-dialog .dialog-actions .btn {
    min-width: 100px;
}
.success-dialog .dialog-actions .btn-qr-center {
    flex: 0 1 auto;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
}

/* Overlay đang tạo website */
.creating-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
}
.creating-card {
    background: var(--card);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    text-align: center;
    min-width: 280px;
}
.creating-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.creating-card h3 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: var(--text);
    font-weight: 600;
}
.creating-progress-wrap {
    height: 6px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 16px;
}
.creating-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ec4899);
    border-radius: 10px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}
.creating-percent {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Order History Modal */
.order-history-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10003;
    align-items: center;
    justify-content: center;
}

.order-history-modal.show {
    display: flex;
}

.order-history-content {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    min-width: 500px;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    scroll-behavior: smooth;
}

.order-history-content::-webkit-scrollbar {
    width: 8px;
}

.order-history-content::-webkit-scrollbar-track {
    background: transparent;
}

.order-history-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.order-history-content::-webkit-scrollbar-thumb:hover {
    background: #3d3d45;
}

.order-history-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--accent);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.order-history-close:hover {
    transform: scale(1.1) rotate(90deg);
}

.order-history-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.order-history-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.order-item {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    background: var(--bg);
    transition: all 0.3s ease;
}

.order-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.2);
}

.order-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.order-item-title {
    font-weight: 600;
    color: var(--text);
    font-size: 1.05rem;
}

.order-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.order-status.FREE {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.order-status.PAID {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.order-status.PENDING {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.order-action-btn.pay {
    border-color: #f59e0b;
    color: #f59e0b;
}

.order-action-btn.pay:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
    color: #f59e0b;
}

.order-item-note {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.order-item-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.order-item-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-item-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.order-action-btn {
    flex: 1;
    min-width: 100px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: var(--card);
    color: var(--text);
    transition: all 0.2s ease;
}

.order-action-btn:hover {
    background: var(--bg);
    border-color: var(--accent);
    color: var(--accent);
}

.order-action-btn.view:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.order-action-btn.copy-order:hover,
.order-action-btn.copy-link:hover {
    border-color: #22c55e;
    color: #22c55e;
}

.order-action-btn.qr:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.order-history-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.order-history-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.order-history-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .order-history-content {
        min-width: 90%;
        max-width: 95%;
        padding: 20px;
    }

    .order-history-header h3 {
        font-size: 1.2rem;
    }

    .order-item {
        padding: 14px;
    }
}

/* Auth + lịch sử đơn hàng (trong form) */
.auth-form-section {
    margin-bottom: 16px;
}

.auth-form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    /* flex-wrap: wrap; */
}

.auth-form-row #authContainer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-auth {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-auth:hover {
    background: var(--border);
    border-color: var(--accent);
}

.btn-lang-toggle {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 68px;
}

.btn-lang-toggle:hover {
    background: var(--bg);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.btn-lang-toggle #langFlag {
    font-size: 1.1rem;
}

.btn-lang-toggle #langCode {
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 8px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    border: 1px solid var(--border);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-avatar .user-avatar-initial {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.user-avatar img + .user-avatar-initial {
    display: none;
}

.user-avatar img.error + .user-avatar-initial {
    display: flex;
}

.user-name {
    font-size: 0.875rem;
    color: var(--text);
}

.btn-logout {
    background: transparent;
    border: 1px solid #9d4c4c;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-logout:hover {
    color: var(--accent);
}

.auth-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    padding: 16px;
}

.auth-dialog {
    background: var(--card);
    border-radius: 12px;
    padding: 28px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
}

.auth-dialog h2 {
    margin: 0 0 8px;
    font-size: 1.5rem;
    color: var(--text);
    text-align: center;
}

.auth-dialog .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 24px;
}

.auth-form-group {
    margin-bottom: 16px;
}

.auth-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    color: var(--text);
    font-weight: 500;
}

.auth-form-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.auth-form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-google {
    width: 100%;
    padding: 10px;
    background: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-google:hover {
    background: #f8f8f8;
}

.btn.loading,
.btn-google.loading {
    opacity: 0.8;
    cursor: not-allowed;
    pointer-events: none;
}
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

.auth-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 16px 0;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}

.auth-divider::before {
    left: 0;
}

.auth-divider::after {
    right: 0;
}

.auth-message {
    padding: 10px;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 16px;
    display: none;
}

.auth-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: block;
}

.auth-message.success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
    display: block;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-avatar-field {
    text-align: center;
}

.auth-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.auth-avatar-preview-outer {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.auth-avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--input-bg);
    overflow: hidden;
}

.auth-avatar-preview img.auth-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.auth-avatar-preview img.auth-avatar-img.empty {
    display: none;
}

.auth-avatar-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-align: center;
    padding: 6px;
}

.auth-avatar-preview.has-image .auth-avatar-placeholder {
    display: none;
}

.auth-avatar-edit {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    border: 2px solid var(--card);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    transition: background 0.2s;
    z-index: 2;
}

.auth-avatar-edit:hover {
    background: var(--accent-hover);
}

.dialog-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.dialog-close-btn:hover {
    background: var(--border);
    color: var(--text);
}

@media (max-width: 768px) {
    .auth-container {
        top: 12px;
        right: 12px;
    }
}

/* Flatpickr theme dark */
.flatpickr-calendar {
    background: var(--card) !important;
    border-color: var(--border) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

.flatpickr-months {
    background: var(--card) !important;
    border-bottom: 1px solid var(--border) !important;
}

.flatpickr-month {
    color: var(--text) !important;
}

.flatpickr-prev-month,
.flatpickr-next-month {
    color: var(--text) !important;
    fill: var(--text) !important;
}

.flatpickr-prev-month:hover,
.flatpickr-next-month:hover {
    color: var(--accent) !important;
    fill: var(--accent) !important;
}

.flatpickr-weekdays {
    background: var(--card) !important;
}

.flatpickr-weekday {
    color: var(--text-muted) !important;
}

.flatpickr-day {
    color: var(--text) !important;
    border-color: transparent !important;
}

.flatpickr-day:hover {
    background: var(--border) !important;
    border-color: var(--border) !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: white !important;
}

.flatpickr-day.today {
    border-color: var(--accent) !important;
}

.flatpickr-day.today:hover {
    background: var(--accent) !important;
    color: white !important;
}

.flatpickr-day.flatpickr-disabled {
    color: var(--text-muted) !important;
    opacity: 0.3 !important;
}

.wallpaper-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.wallpaper-option {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wallpaper-option input {
    display: none;
}

.wallpaper-thumb {
    width: 80px;
    height: 100px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    border: 3px solid var(--border);
    transition: border-color 0.2s;
}

.wallpaper-option input:checked+.wallpaper-thumb,
.wallpaper-option.selected .wallpaper-thumb {
    border-color: var(--accent);
}

.wallpaper-thumb.wallpaper-pick-btn {
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.wallpaper-option span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.avatar-preview.empty {
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.heart-preview-wrap {
    margin-top: 20px;
    text-align: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.heart-preview-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.heart-preview-center {
    position: relative;
    display: inline-block;
    order: 1;
}

.heart-preview-img {
    display: block;
    width: 140px;
    height: auto;
}

.heart-preview-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff8fa3;
    font-size: 0.75em;
    text-align: center;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(255, 77, 109, 0.9), 0 0 20px rgba(255, 77, 109, 0.6);
    line-height: 1.3;
    width: 85%;
}

.heart-preview-text .line2 {
    font-size: 0.6em;
    display: block;
    margin-top: 0.2em;
}

.heart-preview-text .heart-days-label {
    font-size: 0.45em;
    display: block;
    margin-bottom: 0.1em;
    letter-spacing: 0.1em;
}

.heart-preview-text .heart-days-number {
    font-size: 1.1em;
    font-weight: 600;
    display: block;
}

.heart-preview-sides {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    order: 2;
    flex-wrap: wrap;
}

.heart-preview-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.heart-preview-side-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 105, 180, 0.8);
    box-shadow: 0 0 10px rgba(255, 105, 180, 0.4);
}

.heart-preview-name {
    font-size: 0.7rem;
    color: #ffb6c1;
    margin-top: 4px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-preview-mini {
    margin-top: 16px;
}

.chat-preview-mini-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.chat-preview-mini-screen {
    max-width: 260px;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--border);
    background: #171717;
}

.chat-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.4);
}

.chat-preview-avatar-wrap {
    position: relative;
}

.chat-preview-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border);
}

.chat-preview-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #171717;
}

.chat-preview-user-info {
    flex: 1;
    min-width: 0;
}

.chat-preview-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-preview-status {
    font-size: 0.7rem;
    color: #34d399;
}

.chat-preview-messages {
    max-height: 180px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-preview-msg-row {
    display: flex;
    padding: 0 4px;
}

.chat-preview-msg-row.left {
    justify-content: flex-start;
}

.chat-preview-msg-row.right {
    justify-content: flex-end;
}

.chat-preview-bubble {
    max-width: 85%;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.35;
    border-radius: 14px;
}

.chat-preview-bubble.left {
    border-bottom-left-radius: 4px;
}

.chat-preview-bubble.right {
    border-bottom-right-radius: 4px;
}

/* ===== Music Player Styles ===== */
.music-player {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-top: 10px;
}

.music-player-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}

.music-player-btn:hover {
    background: var(--accent-hover);
}

.music-player-btn:active {
    transform: scale(0.95);
}

.music-player-btn.playing {
    background: #22c55e;
}

.music-player-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.music-player-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.music-player-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.music-player-progress {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.music-player-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.1s linear;
}

.music-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.music-input-row input[type="text"] {
    flex: 1;
    min-width: 0;
}

/* Preset Music Section - Beautiful Design */
.preset-music-section {
    margin-top: 16px;
}

.preset-music-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.preset-music-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.preset-music-badge {
    background: linear-gradient(135deg, var(--accent) 0%, #f472b6 100%);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

/* Trigger (spinner) - same UI as item */
.preset-music-trigger {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(28, 28, 32, 0.98) 0%, var(--bg) 100%);
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 8px;
}
.preset-music-trigger:hover {
    background: rgba(236, 72, 153, 0.12);
    border-color: rgba(236, 72, 153, 0.3);
}
.preset-music-section.preset-music-open .preset-music-trigger {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(244, 114, 182, 0.1) 100%);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}
.preset-music-trigger .music-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(236, 72, 153, 0.15);
    border-radius: 10px;
    font-size: 20px;
    flex-shrink: 0;
}
.preset-music-trigger .music-info {
    flex: 1;
    min-width: 0;
}
.preset-music-trigger .music-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.preset-music-trigger .music-file {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: monospace;
}
.preset-music-chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    transform: rotate(0deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.preset-music-section.preset-music-open .preset-music-chevron {
    transform: rotate(180deg);
}

/* Dropdown - hidden by default, shown when open */
.preset-music-dropdown {
    display: none;
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.preset-music-section.preset-music-open .preset-music-dropdown {
    display: block;
    background: linear-gradient(180deg, rgba(28, 28, 32, 0.98) 0%, var(--bg) 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    max-height: 340px;
    overflow-y: auto;
    z-index: 100;
}

.preset-music-dropdown::-webkit-scrollbar {
    width: 6px;
}

.preset-music-dropdown::-webkit-scrollbar-track {
    background: var(--input-bg);
    border-radius: 3px;
}

.preset-music-dropdown::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.preset-music-list {
    padding: 10px;
    display: grid;
    gap: 4px;
}

.preset-music-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.preset-music-item:hover {
    background: rgba(236, 72, 153, 0.12);
    border-color: rgba(236, 72, 153, 0.3);
    transform: translateX(2px);
}

.preset-music-item.selected {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(244, 114, 182, 0.1) 100%);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.preset-music-item .music-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(236, 72, 153, 0.15);
    border-radius: 10px;
    font-size: 20px;
    flex-shrink: 0;
}

.preset-music-item.selected .music-icon {
    background: var(--accent);
}

.preset-music-item .music-info {
    flex: 1;
    min-width: 0;
}

.preset-music-item .music-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    letter-spacing: 0.02em;
}

.preset-music-item .music-file {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: monospace;
}

.preset-music-item .checkmark {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
    opacity: 0;
}

.preset-music-item.selected .checkmark {
    opacity: 1;
}

@media (max-width: 768px) {
    .preset-music-dropdown {
        max-height: 280px;
    }

    .preset-music-trigger {
        padding: 10px 12px;
        gap: 10px;
    }
    .preset-music-trigger .music-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .preset-music-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .preset-music-item .music-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}