/* =========================================================
   Image Submission Manager — Stylesheet v1.1
   ========================================================= */

/* ── Base ────────────────────────────────────────────────── */
.ism-wrap *, .ism-wrap *::before, .ism-wrap *::after { box-sizing: border-box; }

.ism-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1e1e2e;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 48px;
}

/* ── Section titles ──────────────────────────────────────── */
.ism-section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 36px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
    color: #111827;
}

/* ── Login notice ────────────────────────────────────────── */
.ism-login-notice {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}
.ism-login-icon { font-size: 2.5rem; line-height: 1; flex-shrink: 0; }
.ism-login-notice strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.ism-login-notice p { margin: 0 0 14px; color: #6b7280; }

/* ── User banner ─────────────────────────────────────────── */
.ism-user-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 20px;
}
.ism-avatar { border-radius: 50%; display: block; flex-shrink: 0; }
.ism-user-banner strong { display: block; font-size: 1rem; }
.ism-user-login { font-size: .82rem; color: #6b7280; }

.ism-user-context {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: .9rem;
    margin-bottom: 14px;
    color: #0369a1;
}

/* ── Messages ────────────────────────────────────────────── */
.ism-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
    font-size: .95rem;
}
.ism-message.success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.ism-message.error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ── Form ────────────────────────────────────────────────── */
.ism-form { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 24px; }

.ism-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}
.ism-field-full { grid-column: 1 / -1; }

.ism-field { display: flex; flex-direction: column; gap: 6px; }
.ism-field label { font-size: .875rem; font-weight: 600; color: #374151; }
.ism-field .req  { color: #ef4444; }

.ism-field input,
.ism-field select {
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: .95rem;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
    width: 100%;
}
.ism-field input:focus, .ism-field select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.ism-field small { font-size: .8rem; color: #6b7280; }

/* ── Dropzone ────────────────────────────────────────────── */
.ism-dropzone {
    position: relative;
    border: 2px dashed #a5b4fc;
    border-radius: 12px;
    background: #eef2ff;
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}
.ism-dropzone:hover, .ism-dropzone.drag-over { background: #e0e7ff; border-color: #6366f1; }
.ism-dropzone input[type=file] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
    width: 100%; height: 100%; border: none; padding: 0;
}
.ism-dropzone-label { pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ism-dropzone-label .ism-icon { font-size: 2.5rem; line-height: 1; }
.ism-dropzone-label span { font-size: .95rem; font-weight: 500; color: #4338ca; }
.ism-dropzone-label small { color: #6b7280; font-size: .8rem; }

#ism-preview-wrap { margin-top: 12px; }
#ism-preview-img  { max-width: 100%; max-height: 280px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
#ism-preview-info { font-size: .85rem; color: #374151; margin-top: 8px; }

/* ── Buttons ─────────────────────────────────────────────── */
.ism-form-footer { margin-top: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.ism-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 22px; border-radius: 8px; font-size: .95rem; font-weight: 600;
    cursor: pointer; border: none; transition: background .15s, transform .1s;
    text-decoration: none;
}
.ism-btn:active { transform: scale(.97); }
.ism-btn-primary   { background: #6366f1; color: #fff; }
.ism-btn-primary:hover { background: #4f46e5; color: #fff; }
.ism-btn-secondary { background: #e5e7eb; color: #374151; }
.ism-btn-secondary:hover { background: #d1d5db; }
.ism-btn-ghost  { background: transparent; color: #6b7280; border: 1px solid #d1d5db; }
.ism-btn-ghost:hover { background: #f3f4f6; }
.ism-btn-danger { background: #fee2e2; color: #b91c1c; }
.ism-btn-danger:hover { background: #fecaca; }
.ism-btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 6px; }

/* ── Success preview ─────────────────────────────────────── */
#ism-success-preview { margin-top: 24px; }
.ism-uploaded-card {
    display: flex; gap: 20px; align-items: flex-start;
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 20px;
}
.ism-uploaded-card img { max-width: 200px; max-height: 150px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.ism-uploaded-meta { font-size: .9rem; line-height: 1.9; }

/* ── Filter bar ──────────────────────────────────────────── */
.ism-filter-section { margin-top: 40px; }
.ism-filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }

.ism-filter-group { display: flex; flex-direction: column; gap: 5px; }
.ism-filter-label { font-size: .8rem; font-weight: 600; color: #374151; }

.ism-filter-input {
    padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: .9rem; background: #fff; min-width: 140px;
}
.ism-filter-input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }

.ism-filter-status {
    margin-top: 10px; font-size: .85rem; color: #6b7280; font-style: italic;
}

/* ── Gallery grid ────────────────────────────────────────── */
.ism-gallery-wrap { margin-top: 24px; }
.ism-no-images    { color: #6b7280; font-style: italic; }

.ism-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.ism-gallery-item {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: box-shadow .2s, transform .2s; display: flex; flex-direction: column;
}
.ism-gallery-item:hover { box-shadow: 0 8px 24px rgba(0,0,0,.12); transform: translateY(-2px); }

.ism-gallery-thumb {
    position: relative; aspect-ratio: 4/3; overflow: hidden; background: #f3f4f6;
}
.ism-gallery-thumb img { width:100%;height:100%;object-fit:cover;display:block;transition:transform .3s; }
.ism-gallery-item:hover .ism-gallery-thumb img { transform: scale(1.04); }
.ism-gallery-thumb .ism-zoom-icon {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(0,0,0,.5); color: #fff; border-radius: 50%;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    font-size: .8rem; opacity: 0; transition: opacity .2s;
}
.ism-gallery-item:hover .ism-zoom-icon { opacity: 1; }

.ism-gallery-meta { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ism-gallery-meta strong { font-size: .95rem; line-height: 1.3; }
.ism-gallery-meta span   { font-size: .8rem; color: #6b7280; }

.ism-gallery-actions { padding: 10px 14px; border-top: 1px solid #f3f4f6; display: flex; gap: 8px; }

/* ── Tags ────────────────────────────────────────────────── */
.ism-tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .73rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ism-tag-general        { background: #dbeafe; color: #1d4ed8; }
.ism-tag-monochrome     { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.ism-tag-assigned-topic { background: #fef3c7; color: #92400e; }

/* ── Modal ───────────────────────────────────────────────── */
.ism-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; }
.ism-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
.ism-modal-box {
    position: relative; background: #fff; border-radius: 16px; padding: 32px;
    width: min(520px, 94vw); max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    animation: ismModalIn .2s ease-out;
}
@keyframes ismModalIn { from { transform: scale(.92) translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.ism-modal-box h3 { margin: 0 0 20px; font-size: 1.2rem; }
.ism-modal-close {
    position: absolute; top: 16px; right: 16px;
    background: #f3f4f6; border: none; border-radius: 50%;
    width: 32px; height: 32px; font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: #374151;
}
.ism-modal-close:hover { background: #e5e7eb; }

/* ── Lightbox ────────────────────────────────────────────── */
.ism-lightbox { position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center; }
.ism-lightbox-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.88); }
.ism-lightbox-content { position: relative; max-width: 90vw; max-height: 90vh; text-align: center; }
.ism-lightbox-content img { max-width: 90vw; max-height: 80vh; border-radius: 8px; box-shadow: 0 0 40px rgba(0,0,0,.6); display: block; }
#ism-lightbox-caption { color: #e5e7eb; font-size: .9rem; margin-top: 12px; }
.ism-lightbox-close { position: absolute; top: -44px; right: 0; background: transparent; border: none; color: #fff; font-size: 2.2rem; cursor: pointer; line-height: 1; }

/* ── Admin ───────────────────────────────────────────────── */
.ism-admin-wrap h1 .dashicons { vertical-align: middle; margin-right: 6px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .ism-form { padding: 16px; }
    .ism-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .ism-uploaded-card { flex-direction: column; }
    .ism-user-banner { flex-wrap: wrap; }
}
