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

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

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
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(99, 102, 241, 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%; }

/* ── Avatar 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: #f5f3ff; }
.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 ── */
.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;
}
.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; }

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

/* ── 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;
    height: 380px;
    overflow: hidden;
}

/* ── Mini Widget Preview (Modern 2026) ── */
.preview-widget {
    position: absolute;
    bottom: 10px;
    right: 10px;
}
.pw-window {
    width: 270px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(16px);
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid rgba(255,255,255,0.6);
    overflow: hidden;
    margin-bottom: 8px;
}
.pw-header {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: white;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}
.pw-header::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}
.pw-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}
.pw-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    border: 2px solid var(--pw-color, #2563eb);
    position: absolute;
    bottom: -2px;
    right: -2px;
}
.pw-name { font-size: 13px; font-weight: 600; position: relative; z-index: 1; }
.pw-status {
    font-size: 10px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    z-index: 1;
}
.pw-status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #34d399;
    display: inline-block;
}
.pw-messages { padding: 14px; }
.pw-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.pw-msg-avatar {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 600;
    flex-shrink: 0;
}
.pw-msg-text {
    background: white;
    padding: 9px 12px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    font-size: 12px;
    color: #1a1a2e;
    line-height: 1.45;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.04);
}
.pw-msg-time {
    font-size: 9px;
    color: #94a3b8;
    margin-top: 3px;
    padding-left: 30px;
}
.pw-suggestions {
    padding: 6px 14px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.pw-sug {
    font-size: 10px;
    font-weight: 500;
    padding: 4px 10px;
    border: 1.5px solid;
    border-radius: 14px;
    white-space: nowrap;
    transition: all 0.2s;
}
.pw-input {
    border-top: 1px solid rgba(0,0,0,0.05);
    padding: 10px 12px;
    background: rgba(255,255,255,0.8);
}
.pw-input-inner {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pw-input-field {
    flex: 1;
    background: #f8f9fb;
    border: 1.5px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 7px 12px;
    font-size: 11px;
    color: #94a3b8;
}
.pw-mic-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.5;
}
.pw-send-btn {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pw-footer {
    text-align: center;
    font-size: 9px;
    color: #b0b8c9;
    padding: 0 0 8px;
    letter-spacing: 0.02em;
}
.pw-launcher {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15), 0 0 0 0 rgba(99,102,241,0.12);
    margin-left: auto;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pw-launcher:hover {
    transform: scale(1.08);
}

/* ── Result Panel ── */
.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;
}

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

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