/* Botones */
.btn {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #ff7d4d;
    transform: translateY(-1px);
}

/* Formularios */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-textarea {
    resize: vertical;
    min-height: 70px;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--bg-dark);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch.active {
    background: var(--accent);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch.active::after {
    transform: translateX(16px);
}

/* Modales */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-panel);
    border-radius: 12px;
    border: 1px solid var(--border);
    width: 90%;
    max-width: 550px;
    max-height: 80vh;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
}

.modal-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.code-preview {
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent-green);
    max-height: 250px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Editor Toast */
.editor-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #10b981, #059669);
    padding: 14px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 10px 40px rgba(16, 185, 129, .4);
}

.editor-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.editor-toast-icon {
    font-size: 20px;
    color: #fff;
}

.editor-toast-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.editor-toast-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, .8);
}

/* Dropzone */
.dropzone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(13, 13, 18, 0.95);
    z-index: 50;
    transition: all 0.3s ease;
}

.dropzone.hidden {
    opacity: 0;
    pointer-events: none;
}

.dropzone.dragover {
    background: rgba(255, 107, 53, 0.1);
}

.dropzone-content {
    text-align: center;
    padding: 40px;
}

.dropzone-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border: 2px dashed var(--border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    transition: all 0.3s ease;
}

.dropzone.dragover .dropzone-icon {
    border-color: var(--accent);
    background: rgba(255, 107, 53, 0.1);
}

.dropzone-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.dropzone-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Estados Vacíos */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ==================== TEMPLATE CARDS ==================== */
.template-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s;
    cursor: pointer;
}

.template-card:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
    border-color: rgba(255,255,255,0.15);
    transform: translateX(2px);
}

.template-card.selected {
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.10));
    border-color: rgba(99,102,241,0.4);
}

/* Filter Buttons */
.filter-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    font-weight: 500;
}

.filter-btn:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
}

.filter-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #6366f1;
    color: white;
}