/* ===========================
 * AZUA Image System v2 CSS
 * =========================== */

/* --- Global Button Reset (prevent theme override) --- */
.azua-image-form-wrap button,
.azua-image-form-wrap .azua-image-submit-btn,
#azua-image-list-wrapper button,
#azua-image-list-wrapper .azua-copy-btn,
#azua-image-list-wrapper .azua-del-btn,
#azua-image-list-wrapper .azua-page-btn {
    text-decoration: none !important;
    color: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    line-height: normal;
}

/* --- Form Layout (Audio-matched) --- */
.azua-image-form-wrap { display: flex; flex-wrap: wrap; gap: 24px; margin: 1.5em 0; }
.azua-image-form-card,
.azua-image-info-card { flex: 1 1 320px; background: #fff; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,50,100,.08); padding: 28px; box-sizing: border-box; }
.azua-image-form-title { font-size: 1.2em; font-weight: 700; margin: 0 0 20px; color: #1a1a2e; }
.azua-image-field { margin-bottom: 18px; }
.azua-image-field label { display: block; font-weight: 600; margin-bottom: 6px; color: #374151; font-size: .95em; }
.azua-image-field input[type="text"] { width: 100%; padding: 12px 16px; border: 2px solid #e5e7eb; border-radius: 10px; font-size: 1em; background: #fafbfc; transition: border-color .2s; box-sizing: border-box; }
.azua-image-field input[type="text"]:focus { border-color: #00aeea; outline: none; background: #fff; }

/* Dropzone */
.azua-image-dropzone { position: relative; border: 2px dashed #d1d5db; border-radius: 12px; padding: 32px 20px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.azua-image-dropzone.dragover, .azua-image-dropzone:hover { border-color: #00aeea; background: rgba(0,174,234,.04); }
.azua-image-dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.azua-image-dropzone__label { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #6b7280; pointer-events: none; }
.azua-image-dropzone__label svg { color: #00aeea; }
.azua-image-dropzone__label small { color: #9ca3af; font-size: .85em; }
.azua-image-dropzone__preview { pointer-events: none; text-align: center; }

/* Multi-file preview grid */
.azua-image-preview-count { font-weight: 700; color: #00aeea; margin-bottom: 10px; font-size: .95em; }
.azua-image-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
.azua-image-preview-item { border-radius: 8px; overflow: hidden; background: #f3f4f6; text-align: center; }
.azua-image-preview-item img { width: 100%; height: 60px; object-fit: cover; display: block; }
.azua-image-preview-item span { display: block; font-size: .7em; color: #6b7280; padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Submit Button (matched to audio) */
.azua-image-submit-btn {
    display: inline-flex !important; align-items: center; gap: 8px; justify-content: center;
    width: 100%; padding: 14px; border: none !important; border-radius: 12px;
    background: linear-gradient(135deg, #00aeea, #0077b6) !important; color: #fff !important;
    font-size: 1.05em; font-weight: 700; cursor: pointer; transition: opacity .2s, transform .1s;
    text-decoration: none !important;
}
.azua-image-submit-btn:hover { opacity: .9; color: #fff !important; text-decoration: none !important; }
.azua-image-submit-btn:active { transform: scale(.98); }

/* Progress bar */
.azua-image-progress { margin-top: 12px; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.azua-image-progress__bar { height: 100%; background: linear-gradient(90deg, #00aeea, #0077b6); border-radius: 3px; transition: width .2s; width: 0%; }
.azua-image-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: azuaImgSpin .6s linear infinite; vertical-align: middle; }
@keyframes azuaImgSpin { to { transform: rotate(360deg); } }

/* Info card */
.azua-image-info-card p,
.azua-image-info-card li { color: #4b5563; font-size: .93em; line-height: 1.7; }
.azua-image-info-card ul { list-style: none; padding: 0; margin: 10px 0; }
.azua-image-info-card li { padding-left: 1.2em; position: relative; margin-bottom: 8px; }
.azua-image-info-card li::before { content: "•"; color: #00aeea; position: absolute; left: 0; font-weight: 700; }
.azua-image-info-card li strong { color: #00aeea; }
.azua-image-info-card a { color: #00aeea; }
.azua-image-info-note { margin-top: 16px; padding: 12px 16px; background: #fef3c7; border-radius: 8px; color: #92400e; font-size: .88em; }

/* Toast */
.azua-image-toast { padding: 14px 20px; border-radius: 10px; font-weight: 600; margin-bottom: 20px; text-align: center; animation: azuaImgToastIn .3s ease; }
.azua-image-toast--success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.azua-image-toast--error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
@keyframes azuaImgToastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* --- List Controls --- */
.azua-image-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 1em; min-height: 40px; flex-wrap: wrap; }
.azua-image-title { font-size: 1.1em; font-weight: 700; color: #1a1a2e; }
.azua-select-wrapper { display: flex; align-items: center; gap: .5em; flex-wrap: wrap; }
.azua-select-wrapper label { font-weight: 600; white-space: nowrap; font-size: .9em; color: #4b5563; }
.azua-select-wrapper select { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: .9em; background: #fff; }

/* --- List Cards --- */
.azua-image-list { display: flex; flex-direction: column; gap: 10px; }
.azua-card {
    display: flex; align-items: center; gap: 16px; padding: 14px 18px;
    background: #fff; border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,50,100,.06); transition: transform .15s, box-shadow .15s;
}
.azua-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,50,100,.1); }
.azua-card-img { flex: 0 0 80px; height: 64px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 10px; background: #f3f4f6; cursor: pointer; transition: opacity .15s; }
.azua-card-img:hover { opacity: .8; }
.azua-card-img img { width: 80px; height: 64px; object-fit: cover; display: block; border-radius: 8px; }
.azua-card-body { flex: 1; min-width: 0; }
.azua-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 28px; }
.azua-card-top h4 { margin: 0; font-size: .95em; font-weight: 700; color: #1a1a2e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.azua-card-link { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.azua-card-link input { flex: 1; min-width: 0; padding: 5px 10px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: .85em; background: #f9fafb; }
.azua-card-link-placeholder { color: #9ca3af; font-size: .85em; font-style: italic; }
.azua-card-side { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }

/* Badges */
.azua-badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: .78em; font-weight: 700; white-space: nowrap; line-height: 1.6; }
.azua-badge--ok { color: #166534; background: #dcfce7; }
.azua-badge--ng { color: #991b1b; background: #fef2f2; }
.azua-badge--wait { color: #9a3412; background: #fff7ed; }
.azua-cat-badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: .78em; font-weight: 600; background: #eff6ff; color: #1e40af; white-space: nowrap; cursor: pointer; transition: background .15s; line-height: 1.6; }
.azua-cat-badge:hover { background: #dbeafe; }
.azua-cat-select { padding: 3px 8px; border: 1px solid #00aeea !important; border-radius: 8px; font-size: .85em; outline: none; background: #fff; cursor: pointer; }

/* Copy Button */
.azua-copy-btn { padding: 5px 14px; border: 1px solid #00aeea !important; border-radius: 8px; background: #fff !important; color: #00aeea !important; font-weight: 600; font-size: .85em; cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none !important; }
.azua-copy-btn:hover { background: #00aeea !important; color: #fff !important; text-decoration: none !important; }

/* Delete Button */
.azua-del-btn { padding: 6px 18px; border-radius: 999px; border: none !important; background: #fee2e2 !important; color: #dc2626 !important; font-weight: 600; font-size: .85em; cursor: pointer; transition: background .15s; text-decoration: none !important; white-space: nowrap; }
.azua-del-btn:hover { background: #fecaca !important; }

/* Category Selector (upload form) */
.azua-image-category-wrap { display: flex; gap: 8px; flex-wrap: wrap; }
.azua-image-category-wrap select { flex: 1; padding: 10px 14px; border: 2px solid #e5e7eb; border-radius: 10px; font-size: .95em; background: #fafbfc; }
.azua-image-category-wrap select:focus { border-color: #00aeea; outline: none; }
.azua-image-new-cat { flex: 1; padding: 10px 14px; border: 2px solid #e5e7eb; border-radius: 10px; font-size: .95em; background: #fafbfc; margin-top: 6px; }
.azua-image-new-cat:focus { border-color: #00aeea; outline: none; }

/* Edit Button & Inline Edit */
.azua-edit-btn { flex: 0 0 auto; padding: 2px 6px; border: none !important; background: transparent !important; color: #9ca3af !important; font-size: .95em; cursor: pointer; transition: color .15s; text-decoration: none !important; line-height: 1; }
.azua-edit-btn:hover { color: #00aeea !important; }
.azua-editable-title { cursor: default; }
.azua-edit-input { padding: 4px 8px !important; border: 2px solid #00aeea !important; border-radius: 6px !important; font-size: .9em; font-weight: 600; width: auto; min-width: 100px; max-width: 100%; background: #fff !important; }
.azua-save-btn { padding: 3px 12px; border: none !important; border-radius: 6px; background: #00aeea !important; color: #fff !important; font-size: .8em; font-weight: 600; cursor: pointer; margin-left: 4px; text-decoration: none !important; }
.azua-save-btn:hover { background: #0077b6 !important; }
.azua-cancel-btn { padding: 3px 6px; border: none !important; background: transparent !important; color: #9ca3af !important; font-size: .9em; cursor: pointer; text-decoration: none !important; }
.azua-cancel-btn:hover { color: #dc2626 !important; }

/* Lightbox */
.azua-lightbox { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.azua-lightbox--open { opacity: 1; }
.azua-lightbox__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); }
.azua-lightbox__wrap { position: relative; max-width: 90vw; max-height: 90vh; }
.azua-lightbox__wrap img { max-width: 90vw; max-height: 85vh; border-radius: 12px; box-shadow: 0 8px 40px rgba(0,0,0,.4); display: block; }
.azua-lightbox__close { position: absolute; top: -12px; right: -12px; width: 36px; height: 36px; border-radius: 50%; border: none; background: #fff; color: #333; font-size: 1.4em; font-weight: 700; cursor: pointer; box-shadow: 0 2px 12px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; line-height: 1; }
.azua-lightbox__close:hover { background: #f3f4f6; }

/* Pagination */
.azua-pagination { margin-bottom: 12px; }
.azua-pagination-inner { display: flex; gap: 6px; justify-content: flex-end; }
.azua-page-btn { padding: 6px 14px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; cursor: pointer; font-size: .9em; transition: all .15s; text-decoration: none !important; }
.azua-page-btn:hover { border-color: #00aeea; color: #00aeea; }
.azua-page-btn.active { background: #00aeea; color: #fff; border-color: #00aeea; }

/* Loader */
.azua-image-loader { text-align: center; font-weight: 600; padding: 20px; color: #9ca3af; }
.azua-image-empty { text-align: center; color: #9ca3af; padding: 40px; }

@media (max-width: 768px) {
    .azua-image-form-wrap { flex-direction: column; }
    .azua-image-controls { flex-direction: column; align-items: flex-start; }
    .azua-card { flex-direction: column; align-items: stretch; gap: 10px; }
    .azua-card-img { height: auto; max-height: 180px; width: 100%; flex: none; }
    .azua-card-img img { width: 100%; height: auto; max-height: 180px; }
    .azua-card-top { gap: 6px; align-items: center; min-height: 0; }
    .azua-card-top h4 { font-size: .9em; }
    .azua-card-link { flex-direction: column; }
    .azua-card-link input { width: 100%; }
    .azua-card-side { flex-direction: row; justify-content: flex-end; gap: 8px; align-self: stretch; }
    .azua-image-category-wrap { flex-direction: column; }
    .azua-select-wrapper { width: 100%; }
}
