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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #1f2937;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Header ── */
.header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: #2563eb;
    white-space: nowrap;
    flex-shrink: 0;
}
.tagline {
    font-size: 14px;
    color: #6b7280;
    white-space: nowrap;
    flex: 1;
}

/* ── Main Grid ── */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 40px;
    padding-top: 32px;
    padding-bottom: 64px;
}

/* ── Form Section ── */
.form-section {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
}

.form-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    margin: 28px 0 16px;
    color: #111827;
}
.form-group-title:first-child { margin-top: 0; }
.form-group-title small { font-weight: 400; color: #9ca3af; font-size: 14px; }

.step-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #374151;
}
.form-group small {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.form-hint {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
    line-height: 1.5;
}
.form-hint code {
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* ── Form Inputs ── */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #1f2937;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
textarea { resize: vertical; }
select { cursor: pointer; }

.input-with-icon {
    position: relative;
}
.input-with-icon input { padding-right: 42px; }
.toggle-pwd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 4px;
}
.toggle-pwd:hover { color: #2563eb; }

/* ── Color Picker ── */
.color-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active {
    border-color: #1f2937;
    box-shadow: 0 0 0 2px white, 0 0 0 4px currentColor;
}
input[type="color"] {
    width: 32px;
    height: 32px;
    border: 2px dashed #d1d5db;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    background: none;
    -webkit-appearance: none;
    overflow: hidden;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }

/* ── Color Presets ── */
.color-presets {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.color-preset {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    outline: none;
}
.color-preset:hover { transform: scale(1.15); }
.color-preset.active {
    border-color: #1f2937;
    box-shadow: 0 0 0 2px white, 0 0 0 4px rgba(37, 99, 235, 0.4);
    transform: scale(1.1);
}

/* ── Avatar / Logo Upload ── */
.avatar-upload {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: #f8f9fb;
    border: 1.5px dashed #d1d5db;
    border-radius: 14px;
    transition: all 0.2s;
}
.avatar-upload:hover { border-color: #2563eb; background: #eff6ff; }
.avatar-preview {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}
.avatar-letter {
    color: white;
    font-weight: 700;
    font-size: 22px;
}
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}
.avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.avatar-actions small { color: #9ca3af; font-size: 11px; }
.btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: white;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    width: fit-content;
}
.btn-upload:hover { border-color: #2563eb; color: #2563eb; }
.btn-remove-avatar {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    text-align: left;
    width: fit-content;
}
.btn-remove-avatar:hover { text-decoration: underline; }

/* ── Keyword Links ── */
.keyword-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.kw-word {
    flex: 1;
    min-width: 0;
}
.kw-arrow {
    color: #9ca3af;
    font-size: 16px;
    flex-shrink: 0;
}
.kw-url {
    flex: 1.5;
    min-width: 0;
}
.kw-remove {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s;
}
.kw-remove:hover {
    color: #ef4444;
}
.btn-add-keyword {
    background: none;
    border: 1.5px dashed #d1d5db;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 20px;
}
.btn-add-keyword:hover { border-color: #2563eb; color: #2563eb; }

/* ── Review Cards ── */
.review-card {
    background: #fafbfc;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    animation: slideUp 0.3s ease-out;
}
.review-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.review-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.review-card-header select {
    width: auto;
    min-width: 120px;
    flex-shrink: 0;
}
.review-card-header input {
    flex: 1;
    min-width: 0;
}

.review-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.review-card-body textarea {
    min-height: 70px;
}

/* ── Star Selector ── */
.star-selector {
    display: flex;
    align-items: center;
    gap: 4px;
}
.star-selector .star {
    width: 28px;
    height: 28px;
    cursor: pointer;
    color: #d1d5db;
    transition: color 0.15s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    font-family: inherit;
}
.star-selector .star.active {
    color: #f59e0b;
}
.star-selector .star:hover {
    color: #fbbf24;
    transform: scale(1.2);
}
.star-selector .star:hover ~ .star {
    color: #d1d5db;
    transform: scale(1);
}

/* ── Review Meta ── */
.review-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.review-meta input[type="date"] {
    width: auto;
    min-width: 150px;
}
.review-meta .checkbox-label {
    white-space: nowrap;
}

/* ── Add / Remove Review Buttons ── */
.btn-add-review {
    background: none;
    border: 1.5px dashed #d1d5db;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-add-review:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

.btn-remove-review {
    background: none;
    border: 1.5px solid #fecaca;
    border-radius: 8px;
    color: #ef4444;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 10px;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-remove-review:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* ── Radio & Checkbox ── */
.radio-group {
    display: flex;
    gap: 20px;
}
.radio-label, .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    color: #374151;
}
.checkbox-label small { color: #9ca3af; }

/* ── Checkbox Group ── */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.checkbox-group .checkbox-label {
    padding: 10px 14px;
    background: #f8f9fb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s;
}
.checkbox-group .checkbox-label:hover {
    border-color: #2563eb;
    background: #eff6ff;
}
.checkbox-group .checkbox-label input:checked + span {
    color: #2563eb;
    font-weight: 500;
}

/* ── Toggle Checkbox (Modern) ── */
.toggle-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}
.toggle-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    width: 40px;
    height: 22px;
    background: #d1d5db;
    border-radius: 11px;
    position: relative;
    transition: background 0.25s;
    flex-shrink: 0;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.25s;
}
.toggle-checkbox input:checked + .toggle-slider {
    background: #2563eb;
}
.toggle-checkbox input:checked + .toggle-slider::after {
    transform: translateX(18px);
}

/* ── Get Key Link ── */
.get-key-link {
    float: right;
    font-size: 13px;
    font-weight: 500;
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s;
}
.get-key-link:hover { color: #4f46e5; text-decoration: underline; }

/* ── Submit Button ── */
.btn-submit {
    width: 100%;
    padding: 14px 24px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    transition: background 0.2s, transform 0.1s;
}
.btn-submit:hover { background: #4f46e5; }
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.7; cursor: not-allowed; }

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Preview Section ── */
.preview-section { }

.preview-sticky {
    position: sticky;
    top: 24px;
}

.preview-panel, .result-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
    margin-bottom: 20px;
}

.preview-panel h3, .result-panel h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #111827;
}

.preview-device {
    background: #f1f3f5;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.preview-browser-bar {
    background: #e5e7eb;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.preview-browser-bar .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
}
.preview-url {
    margin-left: 12px;
    font-size: 11px;
    color: #9ca3af;
    background: white;
    padding: 2px 10px;
    border-radius: 4px;
    flex: 1;
    text-align: center;
}

.preview-content {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    padding: 16px;
    background: #fafbfc;
}

/* ── Preview Widget: Reviews Container ── */
.pw-reviews-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* ── Preview Widget: Summary Bar ── */
.pw-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(16px);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid rgba(255,255,255,0.6);
    margin-bottom: 4px;
}
.pw-summary-score {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    line-height: 1;
}
.pw-summary-stars {
    display: flex;
    gap: 2px;
    color: #f59e0b;
    font-size: 14px;
}
.pw-summary-count {
    font-size: 11px;
    color: #6b7280;
}

/* ── Preview Widget: Review Card (Glassmorphism) ── */
.pw-review-card {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.03);
    border: 1px solid rgba(255,255,255,0.6);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: fadeIn 0.4s ease-out;
}
.pw-review-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
}

.pw-review-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.pw-review-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.pw-review-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pw-review-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    line-height: 1.3;
}
.pw-source-icon {
    width: 16px;
    height: 16px;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pw-source-icon img,
.pw-source-icon svg {
    width: 100%;
    height: 100%;
}

/* ── Preview Widget: Stars ── */
.pw-stars {
    display: flex;
    gap: 2px;
    margin-bottom: 6px;
    color: #f59e0b;
    font-size: 13px;
}
.pw-stars .star-empty {
    color: #d1d5db;
}

/* ── Preview Widget: Review Text ── */
.pw-review-text {
    font-size: 12px;
    color: #374151;
    line-height: 1.55;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Preview Widget: Date & Verified ── */
.pw-review-date {
    font-size: 10px;
    color: #9ca3af;
}
.pw-review-verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #059669;
    font-weight: 500;
    margin-left: 8px;
}
.pw-review-verified::before {
    content: '';
    width: 12px;
    height: 12px;
    background: #059669;
    border-radius: 50%;
    display: inline-block;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.pw-review-footer {
    display: flex;
    align-items: center;
    margin-top: 4px;
}

/* ── Preview Widget: Slider Nav ── */
.pw-slider-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.pw-slider-nav button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: 1px solid #e5e7eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #6b7280;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}
.pw-slider-nav button:hover {
    background: white;
    border-color: #2563eb;
    color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

/* ── Preview Widget: Slider Dots ── */
.pw-slider-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.pw-slider-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.25s;
}
.pw-slider-dots .dot.active {
    width: 18px;
    border-radius: 3px;
    background: #2563eb;
}

/* ── Result Section ── */
.result-section {
    animation: fadeIn 0.4s ease-out;
}

.result-panel p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 12px;
}
.result-panel code {
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.embed-code {
    width: 100%;
    min-height: 100px;
    background: #1e1e2e;
    color: #cdd6f4;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 13px;
    padding: 16px;
    border: none;
    border-radius: 12px;
    resize: vertical;
    outline: none;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-block {
    position: relative;
    background: #1e1e2e;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}
.code-block pre {
    padding: 20px;
    color: #cdd6f4;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
}
.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #374151;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}
.copy-btn:hover { background: #4b5563; }

.result-info {
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}
.info-item {
    font-size: 14px;
    color: #6b7280;
}

/* ── Footer ── */
.footer {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 16px 0;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    .preview-sticky {
        position: static;
    }
    .header-inner {
        flex-direction: row !important;
        flex-wrap: nowrap;
        gap: 12px;
    }
    .tagline {
        display: none;
    }
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .form-section {
        padding: 20px;
    }
    .container {
        padding: 0 16px;
    }
    .review-card-header {
        flex-direction: column;
        align-items: stretch;
    }
    .review-meta {
        flex-direction: column;
        align-items: stretch;
    }
    .review-meta input[type="date"] {
        width: 100%;
    }
}
