/**
 * AI Baju Editor - gaya frontend.
 * Semua selector di-scope ke .abe-wrap agar tidak bentrok dengan theme.
 */

.abe-wrap {
        max-width: 760px;
        margin: 24px auto;
        padding: 28px;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
        color: #111827;
        font-family: inherit;
        box-sizing: border-box;
}

.abe-wrap *,
.abe-wrap *::before,
.abe-wrap *::after {
        box-sizing: border-box;
}

.abe-wrap h3 {
        margin: 0 0 6px;
        font-size: 20px;
        line-height: 1.3;
        color: #111827;
}

.abe-muted {
        color: #6b7280;
        font-size: 13px;
        line-height: 1.5;
        margin: 4px 0 0;
}

.abe-note {
        font-size: 12px;
        color: #6b7280;
        line-height: 1.5;
}

.abe-hidden {
        display: none !important;
}

.abe-header {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 10px;
        margin-bottom: 12px;
}

.abe-logout {
        font-size: 12px;
        color: #6b7280;
        text-decoration: underline;
}

.abe-logout:hover {
        color: #4f46e5;
}

/* Pesan */
.abe-message {
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 14px;
        border: 1px solid transparent;
}

.abe-msg-error {
        background: #fef2f2;
        color: #b91c1c;
        border-color: #fecaca;
}

.abe-msg-ok {
        background: #f0fdf4;
        color: #166534;
        border-color: #bbf7d0;
}

/* Dropzone */
.abe-dropzone {
        border: 2px dashed #cbd5e1;
        border-radius: 12px;
        padding: 34px 20px;
        text-align: center;
        cursor: pointer;
        transition: border-color 0.2s ease, background 0.2s ease;
        background: #f8fafc;
        outline: none;
}

.abe-dropzone:hover,
.abe-dropzone:focus,
.abe-dropzone.abe-drag {
        border-color: #4f46e5;
        background: #eef2ff;
}

.abe-dropzone.abe-has-file {
        padding: 14px;
}

.abe-dz-title {
        margin: 0;
        font-weight: 600;
        font-size: 15px;
}

.abe-dropzone .abe-muted {
        margin-top: 4px;
}

.abe-file {
        display: none;
}

/* Pratinjau */
.abe-preview {
        margin: 14px 0 0;
}

.abe-preview img {
        max-width: 100%;
        max-height: 340px;
        border-radius: 10px;
        border: 1px solid #e5e7eb;
        display: block;
}

.abe-preview-meta {
        font-size: 12px;
        color: #6b7280;
        margin-top: 6px;
}

.abe-remove {
        background: none;
        border: none;
        color: #4f46e5;
        cursor: pointer;
        font-size: 13px;
        padding: 0;
        margin-top: 6px;
        text-decoration: underline;
}

/* Prompt */
.abe-field {
        margin-top: 18px;
}

.abe-label {
        display: block;
        font-weight: 600;
        font-size: 14px;
        margin-bottom: 6px;
}

.abe-prompt {
        width: 100%;
        min-height: 96px;
        border: 1px solid #d1d5db;
        border-radius: 10px;
        padding: 10px 12px;
        font-size: 14px;
        line-height: 1.5;
        resize: vertical;
        font-family: inherit;
        color: #111827;
}

.abe-prompt:focus {
        border-color: #4f46e5;
        outline: 2px solid rgba(79, 70, 229, 0.15);
}

.abe-counter {
        font-size: 12px;
        color: #6b7280;
        margin-top: 4px;
        text-align: right;
}

.abe-counter.abe-over {
        color: #b91c1c;
        font-weight: 600;
}

.abe-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 10px;
}

.abe-chip {
        background: #eef2ff;
        color: #3730a3;
        border: 1px solid #c7d2fe;
        border-radius: 999px;
        padding: 6px 12px;
        font-size: 12px;
        cursor: pointer;
        font-family: inherit;
}

.abe-chip:hover {
        background: #e0e7ff;
}

.abe-chip.abe-active {
        background: #4f46e5;
        color: #ffffff;
        border-color: #4f46e5;
}

.abe-ratio {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 2px;
}

.abe-ratio .abe-note {
        flex-basis: 100%;
        margin: 2px 0 0;
}

/* Baris URL gambar */
.abe-urlrow {
        display: flex;
        gap: 8px;
        margin-top: 10px;
}

.abe-url-input {
        flex: 1 1 auto;
        min-width: 0;
        padding: 10px 12px;
        border: 1px solid #d1d5db;
        border-radius: 10px;
        font-size: 14px;
        font-family: inherit;
        color: #111827;
}

.abe-url-input:focus {
        border-color: #4f46e5;
        outline: 2px solid rgba(79, 70, 229, 0.15);
}

.abe-url-btn {
        white-space: nowrap;
}

/* Tombol */
.abe-btn {
        display: inline-block;
        padding: 10px 18px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        border: 1px solid transparent;
        font-family: inherit;
        line-height: 1.4;
        text-align: center;
}

.abe-btn-primary {
        background: #4f46e5;
        color: #ffffff;
}

.abe-btn-primary:hover {
        background: #4338ca;
        color: #ffffff;
}

.abe-btn-secondary {
        background: #ffffff;
        color: #374151;
        border-color: #d1d5db;
}

.abe-btn-secondary:hover {
        background: #f3f4f6;
}

.abe-btn:disabled {
        opacity: 0.55;
        cursor: not-allowed;
}

.abe-submit-row {
        margin-top: 18px;
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
}

/* Progres */
.abe-progress {
        text-align: center;
        padding: 30px 10px;
}

.abe-spinner {
        width: 42px;
        height: 42px;
        border: 4px solid #e0e7ff;
        border-top-color: #4f46e5;
        border-radius: 50%;
        animation: abe-spin 1s linear infinite;
        margin: 6px auto 14px;
}

@keyframes abe-spin {
        to { transform: rotate(360deg); }
}

.abe-status-text {
        font-size: 16px;
        font-weight: 600;
}

.abe-status-sub {
        font-size: 13px;
        color: #6b7280;
        margin-top: 6px;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
}

.abe-elapsed {
        font-size: 13px;
        color: #4f46e5;
        margin-top: 8px;
        font-variant-numeric: tabular-nums;
}

.abe-progress .abe-btn {
        margin-top: 16px;
}

/* Gate */
.abe-input-code {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #d1d5db;
        border-radius: 10px;
        font-size: 14px;
        margin: 12px 0;
        font-family: inherit;
}

.abe-input-code:focus {
        border-color: #4f46e5;
        outline: 2px solid rgba(79, 70, 229, 0.15);
}

/* Hasil */
.abe-results {
        display: flex;
        flex-wrap: wrap;
        gap: 16px;
        margin-top: 14px;
}

.abe-result-item {
        margin: 0;
        flex: 1 1 260px;
        max-width: 100%;
}

.abe-result-item img {
        width: 100%;
        border-radius: 10px;
        border: 1px solid #e5e7eb;
        display: block;
}

.abe-result-item .abe-dl {
        display: inline-block;
        margin-top: 10px;
        text-decoration: none;
}

[data-panel="result"] .abe-btn {
        margin-top: 16px;
}

/* Slot gambar kedua (foto baju / referensi) */
.abe-drop-label {
        font-weight: 600;
        font-size: 14px;
        margin: 18px 0 8px;
        color: #0f172a;
}

.abe-drop-label .abe-req {
        font-size: 11px;
        font-weight: 600;
        color: #b45309;
        background: #fef3c7;
        border: 1px solid #fde68a;
        border-radius: 999px;
        padding: 1px 8px;
        margin-left: 4px;
        vertical-align: middle;
}

.abe-dropzone-sm {
        padding: 18px 16px;
}

.abe-dropzone-sm .abe-dz-title {
        font-size: 14px;
}

/* Responsif */
@media (max-width: 560px) {
        .abe-wrap {
                padding: 20px;
                margin: 12px;
        }

        .abe-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 2px;
        }
}
