:root {
    --bg-base: #0f0f12;
    --bg-surface: #1a1a1f;
    --bg-elevated: #222228;
    --bg-card: #282830;
    --bg-input: #1a1a1f;
    --border: #2a2a32;
    --border-hover: #3a3a44;
    --text-primary: #e8e8ed;
    --text-secondary: #9898a6;
    --text-muted: #6b6b78;
    --accent: #5865F2;
    --accent-hover: #4752c4;
    --success: #3ba55c;
    --danger: #ed4245;
    --warning: #f0b232;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== TOP BAR ========== */
.top-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.top-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.version-tag {
    font-size: 10px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.top-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.webhook-bar {
    display: flex;
    gap: 10px;
    max-width: 650px;
    width: 100%;
}

.input-icon {
    position: relative;
    flex: 1;
}

.input-icon svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

.input-icon:last-child {
    flex: 0.35;
    min-width: 160px;
}

.top-input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: all var(--transition);
}

.top-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.15);
}

.top-input::placeholder {
    color: var(--text-muted);
}

.top-right {
    display: flex;
    gap: 8px;
}

.top-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
    white-space: nowrap;
}

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

.secondary-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.danger-btn {
    background: rgba(237, 66, 69, 0.1);
    color: var(--danger);
    border: 1px solid transparent;
}

.danger-btn:hover {
    background: rgba(237, 66, 69, 0.2);
}

.send-btn {
    background: var(--accent);
    color: #fff;
    border: 1px solid transparent;
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.3);
}

.send-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(88, 101, 242, 0.4);
    transform: translateY(-1px);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========== MAIN CONTAINER ========== */
.main-container {
    display: grid;
    grid-template-columns: 480px 1fr;
    flex: 1;
    overflow: hidden;
}

/* ========== EDITOR SIDEBAR ========== */
.editor-sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.editor-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 14px;
}

.badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ========== MODERN INPUTS ========== */
.modern-input {
    position: relative;
    flex: 1;
}

.modern-input label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted);
    pointer-events: none;
    transition: all var(--transition);
    background: var(--bg-elevated);
    padding: 0 4px;
}

.floating-input {
    width: 100%;
    padding: 11px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: all var(--transition);
}

.floating-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
}

.floating-input:focus + label,
.floating-input:not(:placeholder-shown) + label {
    top: 0;
    font-size: 10px;
    color: var(--accent);
    font-weight: 600;
}

.floating-input::placeholder {
    color: transparent;
}

.input-row {
    display: flex;
    gap: 10px;
}

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

.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 14px; }

.modern-textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 70px;
    transition: all var(--transition);
}

.modern-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
}

.modern-textarea::placeholder {
    color: var(--text-muted);
}

/* ========== CHECKBOX ========== */
.modern-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.modern-checkbox.small {
    font-size: 11px;
    gap: 6px;
}

.modern-checkbox input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    position: relative;
    transition: all var(--transition);
    flex-shrink: 0;
}

.modern-checkbox.small .checkmark {
    width: 16px;
    height: 16px;
}

.modern-checkbox input:checked + .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.modern-checkbox input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.flags-row {
    display: flex;
    gap: 20px;
    margin-top: 12px;
}

/* ========== EMBED CARD ========== */
.embed-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    transition: all var(--transition);
}

.embed-card:hover {
    border-color: var(--border-hover);
}

.embed-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.embed-card-header:hover {
    background: rgba(255,255,255,0.02);
}

.embed-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.embed-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}

.embed-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.embed-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.card-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.card-btn.danger-btn:hover {
    color: var(--danger);
    background: rgba(237, 66, 69, 0.1);
}

.collapse-icon {
    color: var(--text-muted);
    margin-left: 4px;
    transition: transform var(--transition);
}

.embed-card-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.embed-card-body {
    padding: 0 16px 16px;
}

.embed-card-body.collapsed {
    display: none;
}

/* ========== ADD BUTTON ========== */
.add-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    transition: all var(--transition);
}

.add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(88, 101, 242, 0.05);
}

.limit-warning {
    background: rgba(240, 178, 50, 0.1);
    color: var(--warning);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    margin-top: 10px;
}

/* ========== FIELDS ========== */
.field-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-row {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 8px;
}

.field-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.field-inputs input {
    padding: 7px 10px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
}

.field-inputs input:focus {
    outline: none;
    border-color: var(--accent);
}

.field-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.icon-remove:hover {
    color: var(--danger);
    background: rgba(237, 66, 69, 0.1);
}

.add-field-btn {
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    transition: all var(--transition);
}

.add-field-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-secondary);
}

/* ========== COMPONENTS ========== */
.component-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
}

.component-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.button-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 8px;
}

.button-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.button-style-select {
    padding: 5px 8px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 11px;
    font-family: inherit;
}

.button-card input {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    margin-bottom: 4px;
}

.button-card input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ========== PREVIEW AREA ========== */
.preview-area {
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
    overflow: hidden;
}

.preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.preview-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-toggle {
    display: flex;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.toggle-btn {
    padding: 6px 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition);
}

.toggle-btn.active {
    background: var(--accent);
    color: #fff;
}

.preview-scroll {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.preview-scroll.mobile {
    max-width: 420px;
    margin: 0 auto;
}

.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
}

.empty-icon {
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.empty-sub {
    font-size: 13px;
    color: var(--text-muted);
    opacity: 0.7;
}

/* ========== DISCORD PREVIEW ========== */
.discord-msg {
    display: flex;
    gap: 14px;
    padding: 6px 0;
    animation: msgIn 0.3s ease;
}

.discord-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow-sm);
}

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

.discord-name-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
}

.discord-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.discord-tag {
    font-size: 9px;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
}

.discord-time {
    font-size: 11px;
    color: #949ba4;
    margin-left: auto;
}

.discord-text {
    font-size: 14px;
    color: #dbdee1;
    line-height: 1.55;
    margin-bottom: 6px;
    word-wrap: break-word;
}

.discord-embed {
    background: #2b2d31;
    border-left: 4px solid #5865F2;
    border-radius: 4px;
    padding: 14px 16px;
    margin-top: 4px;
    max-width: 520px;
}

.embed-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.embed-auth-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.embed-auth-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.embed-auth-name a {
    color: #fff;
    text-decoration: none;
}

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

.embed-ttl {
    font-size: 15px;
    font-weight: 600;
    color: #ffff;
    margin-bottom: 8px;
}

.embed-ttl a {
    color: #00a8fc;
    text-decoration: none;
}

.embed-ttl a:hover {
    text-decoration: underline;
}

.embed-desc {
    font-size: 13px;
    color: #dbdee1;
    line-height: 1.5;
    margin-bottom: 14px;
}

.embed-fields {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.embed-fields.in2 { grid-template-columns: 1fr 1fr; }
.embed-fields.in3 { grid-template-columns: 1fr 1fr 1fr; }

.embed-fname {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.embed-fval {
    font-size: 12px;
    color: #dbdee1;
}

.embed-img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 14px;
}

.embed-thumb {
    float: right;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-left: 14px;
    margin-bottom: 6px;
}

.embed-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.embed-foot-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.embed-foot-text {
    font-size: 11px;
    color: #949ba4;
}

.embed-ts {
    font-size: 11px;
    color: #949ba4;
    margin-top: 8px;
}

.discord-btns {
    margin-top: 8px;
}

.discord-btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.discord-btn {
    padding: 7px 16px;
    border: none;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: #fff;
    font-family: inherit;
}

.discord-btn.p { background: #5865F2; }
.discord-btn.s { background: #4f545c; }
.discord-btn.g { background: #3ba55c; }
.discord-btn.d { background: #ed4245; }
.discord-btn.l { background: transparent; color: #00a8fc; padding: 7px 0; }

/* ========== TOAST ========== */
.toast {
    position: fixed;
    top: 16px;
    right: 16px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    z-index: 999;
    animation: slideR 0.3s ease;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: #000; }

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

@keyframes slideR {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideL {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* Responsivo */
@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    .editor-sidebar {
        max-height: 50vh;
    }
}