/* ================================================================
   ContentReview — Production CSS
   ASP.NET Core 10 + MSSQL + OpenCV
   ================================================================ */

:root {
    --bg:         #0b0d13;
    --bg2:        #111318;
    --bg3:        #181c24;
    --bg4:        #1f2330;
    --border:     #222738;
    --border2:    #2c3248;
    --text:       #e4e8f4;
    --text2:      #8893b0;
    --text3:      #4e5878;
    --accent:     #3d9eff;
    --accent-dim: rgba(61,158,255,0.12);
    --accent2:    #2c87e8;
    --green:      #22d084;
    --green-dim:  rgba(34,208,132,0.1);
    --red:        #ff4d6a;
    --red-dim:    rgba(255,77,106,0.1);
    --amber:      #f5a623;
    --amber-dim:  rgba(245,166,35,0.1);
    --purple:     #a78bfa;
    --purple-dim: rgba(167,139,250,0.1);
    --shadow:     0 8px 32px rgba(0,0,0,0.5);
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
    --radius:     12px;
    --radius-sm:  8px;
    --mono:       'Space Mono', monospace;
    --sans:       'DM Sans', system-ui, sans-serif;
    --header-h:   58px;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ────────────────────────────────────────────────────── */
.app-header {
    height: var(--header-h);
    background: rgba(11,13,19,0.96);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
    flex-shrink: 0;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--sans);
    font-size: 17px;
    font-weight: 400;
    color: var(--text2);
    text-decoration: none;
    letter-spacing: -0.3px;
}
.brand strong { color: var(--text); font-weight: 700; }
.header-nav { display: flex; align-items: center; gap: 12px; }
.user-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text2);
    padding: 5px 12px;
    border-radius: 100px;
    font-family: var(--mono);
    font-size: 11px;
}
.logout-form { margin: 0; }
.btn-logout {
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text3);
    padding: 5px 12px;
    border-radius: 100px;
    font-family: var(--sans);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }

/* ── Main ───────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ── Footer ────────────────────────────────────────────────────── */
.app-footer {
    text-align: center;
    padding: 16px 24px;
    color: var(--text3);
    font-family: var(--mono);
    font-size: 11px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ── Page Header ───────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}
.page-sub {
    color: var(--text3);
    font-family: var(--mono);
    font-size: 12px;
    margin-top: 4px;
}

/* ── Card Grid ──────────────────────────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* ── Content Card ───────────────────────────────────────────────── */
.content-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.content-card:hover {
    border-color: var(--border2);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.card-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg3);
    overflow: hidden;
    flex-shrink: 0;
}
.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.content-card:hover .card-image { transform: scale(1.03); }
.card-image.img-error {
    object-fit: contain;
    padding: 16px;
    filter: grayscale(1) opacity(0.4);
}
.card-no-image {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text3);
    font-size: 12px;
}
.card-id-badge {
    position: absolute;
    top: 10px; left: 10px;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    color: var(--text2);
    font-family: var(--mono);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 100px;
    border: 1px solid rgba(255,255,255,0.08);
}

.card-body {
    padding: 16px 18px 12px;
    flex: 1;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-detail {
    font-size: 13px;
    color: var(--text2);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 18px 16px;
    border-top: 1px solid var(--border);
}
.card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.card-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.card-btn:active:not(:disabled) { transform: scale(0.97); }

.btn-accept {
    background: var(--green-dim);
    border-color: rgba(34,208,132,0.25);
    color: var(--green);
}
.btn-accept:hover:not(:disabled) { background: rgba(34,208,132,0.18); border-color: rgba(34,208,132,0.45); }

.btn-edit-image {
    background: var(--accent-dim);
    border-color: rgba(61,158,255,0.25);
    color: var(--accent);
}
.btn-edit-image:hover:not(:disabled) { background: rgba(61,158,255,0.2); border-color: rgba(61,158,255,0.45); }

.btn-edit-text {
    background: var(--amber-dim);
    border-color: rgba(245,166,35,0.25);
    color: var(--amber);
}
.btn-edit-text:hover:not(:disabled) { background: rgba(245,166,35,0.2); border-color: rgba(245,166,35,0.45); }

.btn-reject {
    background: var(--red-dim);
    border-color: rgba(255,77,106,0.25);
    color: var(--red);
}
.btn-reject:hover:not(:disabled) { background: rgba(255,77,106,0.2); border-color: rgba(255,77,106,0.45); }

/* ── Empty State ────────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 24px;
    text-align: center;
    color: var(--text3);
}
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text2); }
.empty-state p  { font-size: 14px; }

/* ── Login ──────────────────────────────────────────────────────── */
.login-wrap {
    min-height: calc(100vh - var(--header-h) - 53px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: radial-gradient(ellipse 55% 40% at 50% 10%, rgba(61,158,255,0.05) 0%, transparent 65%);
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    box-shadow: var(--shadow);
}
.login-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.login-title { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--text3); font-size: 13px; margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.val-summary { background: var(--red-dim); border: 1px solid rgba(255,77,106,0.3); color: var(--red); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.val-summary:empty { display: none; }

/* ── Form Controls ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61,158,255,0.12);
}
.form-input::placeholder { color: var(--text3); }
.form-textarea {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    padding: 10px 14px;
    outline: none;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.6;
}
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61,158,255,0.12);
}
.field-error { color: var(--red); font-size: 12px; }

.pw-wrap { position: relative; }
.pw-toggle {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text3); cursor: pointer; padding: 4px;
    display: flex; align-items: center;
}
.pw-toggle:hover { color: var(--text2); }

.form-row-check { display: flex; align-items: center; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text2); }
.checkbox-input { display: none; }
.checkbox-custom {
    width: 18px; height: 18px;
    border: 1px solid var(--border2);
    border-radius: 4px;
    background: var(--bg3);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.checkbox-input:checked + .checkbox-custom {
    background: var(--accent);
    border-color: var(--accent);
}
.checkbox-input:checked + .checkbox-custom::after {
    content: '';
    width: 10px; height: 7px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
    display: block;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent2); border-color: var(--accent2); }

.btn-ghost {
    background: var(--bg3);
    border-color: var(--border2);
    color: var(--text2);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--border); color: var(--text); }

.btn-accent {
    background: var(--green-dim);
    border-color: rgba(34,208,132,0.3);
    color: var(--green);
}
.btn-accent:hover:not(:disabled) { background: rgba(34,208,132,0.18); border-color: rgba(34,208,132,0.5); }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 13px; font-size: 12px; }

.page-header-actions { display: flex; gap: 10px; }

/* ════════════════════════════════════════════════════════════════
   MODALS
   Text modal  : centred, standard
   Image modal : full-height, anchored to top, vertical layout
   ════════════════════════════════════════════════════════════════ */

/* shared backdrop */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.78);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeInBd 0.18s ease;
}
@keyframes fadeInBd { from { opacity: 0; } to { opacity: 1; } }

/* ── Standard (text) modal ──────────────────────────────────────── */
.modal {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    animation: slideUp 0.22s ease;
    overflow: hidden;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ── Image editor modal — full height, top-anchored ─────────────── */
#imageModal {
    align-items: flex-start;   /* pin to top of viewport */
    justify-content: center;
    padding: 0;
    overflow: hidden;
}
.modal-xl {
    max-width: 100%;
    width: 100%;
    height: 100dvh;            /* full viewport height */
    max-height: 100dvh;
    border-radius: 0;
    margin: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    display: flex;
    flex-direction: column;
}

/* common header / body / footer */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg2);
}
.modal-title {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-subtitle {
    font-size: 11px;
    font-weight: 400;
    color: var(--text3);
    font-family: var(--mono);
}
.modal-close {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 6px;
    color: var(--text3);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.modal-close:hover { color: var(--red); border-color: rgba(255,77,106,0.4); background: var(--red-dim); }

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
}

/* editor body fills remaining height vertically */
.modal-body-editor {
    padding: 12px 16px;
    gap: 10px;
    overflow: hidden;          /* child canvas-wrap gets the scroll */
    display: flex;
    flex-direction: column;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg2);
}

/* ── Image Editor internals ─────────────────────────────────────── */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    flex-shrink: 0;
}
.tool-group-label {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.editor-tools { display: flex; align-items: center; gap: 6px; }
.tool-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 6px;
    border: 1px solid var(--border2);
    background: transparent;
    color: var(--text2);
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.tool-btn:hover  { background: var(--bg4); color: var(--text); border-color: var(--border); }
.tool-btn.active {
    background: var(--accent-dim);
    border-color: rgba(61,158,255,0.4);
    color: var(--accent);
}
.editor-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.slider {
    -webkit-appearance: none;
    width: 90px; height: 3px;
    background: var(--border2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s;
}
.slider::-webkit-slider-thumb:hover { background: var(--accent2); }
.slider-val { font-family: var(--mono); font-size: 11px; color: var(--text3); min-width: 34px; }

/* canvas wrapper — fills all remaining vertical space */
.editor-canvas-wrap {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: auto;
    flex: 1;                    /* stretch to fill modal body */
    min-height: 0;              /* allow shrink below content */
    background:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: var(--bg);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.editor-processing {
    position: absolute; inset: 0;
    background: rgba(11,13,19,0.88);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 10;
    border-radius: var(--radius-sm);
}
.editor-spinner {
    width: 44px; height: 44px;
    border: 3px solid var(--border2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}
.editor-processing p     { color: var(--text2); font-size: 13px; }
.editor-processing small { color: var(--text3); font-family: var(--mono); font-size: 11px; }

.editor-canvas-stack {
    position: relative;
    display: inline-block;
    margin: auto;
    max-width: 100%;
}
.editor-img {
    display: block;
    max-width: 100%;
    height: auto;
    user-select: none;
    pointer-events: none;
    border-radius: 2px;
}
.editor-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    cursor: crosshair;
    touch-action: none;
}

/* ── Status bar below canvas ────────────────────────────────────── */
.editor-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 12px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.editor-hint {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    flex: 1;
}

/* ── Result bar ─────────────────────────────────────────────────── */
.result-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(34,208,132,0.07);
    border: 1px solid rgba(34,208,132,0.25);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
    animation: slideUp 0.2s ease;
}
.result-info { display: flex; align-items: center; gap: 8px; color: var(--text2); font-size: 13px; }
.result-btns { display: flex; gap: 8px; }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 28px; left: 50%;
    transform: translateX(-50%) translateY(0);
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: 12px 20px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    animation: toastIn 0.25s ease;
    max-width: 90vw;
}
.toast.toast-success { border-color: rgba(34,208,132,0.4); color: var(--green); }
.toast.toast-error   { border-color: rgba(255,77,106,0.4);  color: var(--red);   }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ── Utilities ──────────────────────────────────────────────────── */
.hidden { display: none !important; }

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

.result-inline-info {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text2);
    white-space: nowrap;
}
.result-inline-info strong { color: var(--green); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .editor-actions { margin-left: 0; width: 100%; }
    .editor-toolbar { gap: 8px; }
}

@media (max-width: 768px) {
    .main-content { padding: 20px 16px; }
    .header-inner { padding: 0 16px; }
    .card-grid { grid-template-columns: 1fr; }
    /* standard modal slides up from bottom on mobile */
    .modal-backdrop:not(#imageModal) { align-items: flex-end; padding: 0; }
    .modal:not(.modal-xl) {
        max-width: 100%;
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: 92vh;
    }
    /* image modal stays full-screen top-anchored on mobile too */
    .modal-xl { border-radius: 0; height: 100dvh; max-height: 100dvh; }
    .card-actions { grid-template-columns: 1fr 1fr; }
    .result-bar { flex-direction: column; align-items: flex-start; }
    .result-btns { width: 100%; }
    .result-btns .btn { flex: 1; justify-content: center; }
    .btn-full { padding: 11px 18px; }
    .user-badge { display: none; }
    .editor-toolbar { padding: 8px 10px; }
}
@media (max-width: 480px) {
    .card-actions { grid-template-columns: 1fr 1fr; }
    .editor-tools { flex-wrap: wrap; gap: 4px; }
    .tool-btn { padding: 5px 8px; font-size: 11px; }
    .tool-btn svg { display: none; }
    .editor-actions { flex-wrap: wrap; gap: 6px; }
    .modal-header { padding: 10px 14px; }
    .modal-body-editor { padding: 8px 10px; gap: 8px; }
}
