/* Trinico Cloud SaaS — admin styles
 * Brand colours: #1B77C9 cobalt, #44A8DA sky, #ABC441 green, #FF6600 orange,
 *                #0d1f33 dark, neutrals from Inter / system stack.
 */
:root {
    --c-primary: #1B77C9;
    --c-primary-dk: #155a99;
    --c-light: #44A8DA;
    --c-green: #ABC441;
    --c-orange: #FF6600;
    --c-dark: #0d1f33;
    --c-bg: #f5f7fb;
    --c-surface: #ffffff;
    --c-border: #e2e8f0;
    --c-text: #1f2937;
    --c-text-mute: #5a6b7e;
    --c-sidebar: #0d1f33;
    --c-sidebar-text: #cdd9e6;
    --r-md: 8px;
    --r-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, .08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--c-text); background: var(--c-bg); -webkit-font-smoothing: antialiased; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dk); text-decoration: underline; }

/* ===== App shell ===== */
.trz-app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.trz-sidebar {
    background: var(--c-sidebar); color: var(--c-sidebar-text);
    display: flex; flex-direction: column;
    padding: 18px 0;
    position: sticky; top: 0; height: 100vh;
}
.trz-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 20px 18px; color: #fff; text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.trz-brand:hover { color: #fff; text-decoration: none; }
.trz-brand-mark { color: var(--c-light); font-size: 22px; line-height: 1; }
.trz-brand-mark-lg { font-size: 38px; }
.trz-brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.trz-nav { display: flex; flex-direction: column; padding: 14px 10px; flex: 1; }
.trz-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--r-md);
    color: var(--c-sidebar-text); font-size: 14px; font-weight: 500;
    text-decoration: none; margin-bottom: 2px;
}
.trz-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.trz-nav a.active { background: var(--c-primary); color: #fff; }
.trz-nav-ico { font-size: 16px; width: 22px; text-align: center; }

.trz-sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.trz-user { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; }
.trz-user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--c-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
}
.trz-user-meta { font-size: 12px; line-height: 1.3; }
.trz-user-name { color: #fff; font-weight: 600; }
.trz-user-email { color: rgba(255, 255, 255, .55); }
.trz-signout {
    display: block; padding: 6px 0; font-size: 12px;
    color: rgba(255, 255, 255, .55);
}
.trz-signout:hover { color: #fff; }

/* ===== Main content ===== */
.trz-main { padding: 28px 36px; max-width: 1320px; }
.trz-page-head { margin-bottom: 22px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.trz-page-head h1 { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.trz-page-sub { margin: 0; color: var(--c-text-mute); font-size: 14px; }

/* ===== Flash messages ===== */
.trz-flash { padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 14px; }
.trz-flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.trz-flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.trz-flash-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== Tiles (dashboard) ===== */
.trz-grid { display: grid; gap: 16px; }
.trz-grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.trz-tile {
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg);
    padding: 20px; box-shadow: var(--shadow-sm);
    color: var(--c-text); text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    display: block;
}
.trz-tile:hover {
    text-decoration: none; transform: translateY(-2px);
    box-shadow: var(--shadow-md); border-color: var(--c-primary);
}
.trz-tile-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.trz-tile-ico { font-size: 28px; margin-bottom: 10px; }
.trz-tile-title { font-weight: 700; margin-bottom: 6px; font-size: 15px; }
.trz-tile-desc { color: var(--c-text-mute); font-size: 13px; line-height: 1.5; }
.trz-pill {
    display: inline-block; font-size: 10px; padding: 1px 8px; border-radius: 10px;
    background: #e5e7eb; color: #555; font-weight: 600; margin-left: 6px; text-transform: uppercase;
}

/* ===== Cards / sections ===== */
.trz-card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r-lg); padding: 20px; margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.trz-card h2 {
    margin: 0 0 12px; font-size: 16px; font-weight: 700;
    color: var(--c-primary); padding-bottom: 8px; border-bottom: 1px solid var(--c-border);
}
.trz-card h3 {
    margin: 16px 0 8px; font-size: 13px; font-weight: 600;
    color: var(--c-text-mute); text-transform: uppercase; letter-spacing: .5px;
}

/* ===== Forms ===== */
.trz-form-row { margin-bottom: 14px; display: block; }
.trz-form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--c-text); }
.trz-form-row input[type=text], .trz-form-row input[type=email],
.trz-form-row input[type=password], .trz-form-row select, .trz-form-row textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 14px; color: var(--c-text); background: #fff; font-family: inherit;
}
.trz-form-row input:focus, .trz-form-row select:focus, .trz-form-row textarea:focus {
    outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(27, 119, 201, .15);
}
.trz-form-row textarea { min-height: 96px; resize: vertical; }
.trz-form-row .trz-help { display: block; margin-top: 5px; font-size: 12px; color: var(--c-text-mute); }
.trz-form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.trz-btn {
    display: inline-block; padding: 9px 18px; border-radius: 6px;
    border: 1px solid var(--c-border); background: #fff; color: var(--c-text);
    font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.trz-btn:hover { background: #f1f5f9; }
.trz-btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.trz-btn-primary:hover { background: var(--c-primary-dk); border-color: var(--c-primary-dk); color: #fff; }
.trz-btn-lg { padding: 11px 22px; font-size: 15px; }
.trz-btn-link { background: none; border: 0; color: var(--c-primary); padding: 0; }

/* ===== Login ===== */
.trz-login-body {
    background: linear-gradient(135deg, #0d1f33 0%, #1B77C9 100%);
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    font-family: var(--font); padding: 20px;
}
.trz-login-card {
    background: #fff; padding: 36px 32px; border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25); width: 100%; max-width: 380px;
}
.trz-login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; justify-content: center; }
.trz-login-brand-name { font-size: 20px; font-weight: 700; color: var(--c-dark); }
.trz-login-title { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.trz-login-sub { margin: 0 0 20px; color: var(--c-text-mute); font-size: 14px; }
.trz-login-form label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
.trz-login-form input { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; margin-top: 4px; font-family: inherit; }
.trz-login-form button { width: 100%; margin-top: 6px; padding: 11px; }

/* ===== Studio-specific ===== */
.trz-studio-defaults summary { list-style: none; }
.trz-studio-defaults summary::-webkit-details-marker { display: none; }
.trz-imgtype-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 10px; }
.trz-imgtype-card {
    position: relative; background: #fff; border: 2px solid var(--c-border); border-radius: 10px;
    padding: 0; cursor: pointer; display: block; overflow: hidden;
    transition: all .15s ease;
}
.trz-imgtype-card:hover { border-color: var(--c-primary); transform: translateY(-1px); }
.trz-imgtype-card input { position: absolute; opacity: 0; pointer-events: none; }
.trz-imgtype-card.selected { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary) inset, var(--shadow-md); }
.trz-imgtype-thumb { width: 100%; aspect-ratio: 1/1; background: #f5f5f5; display: block; object-fit: cover; }
.trz-imgtype-body { padding: 10px 12px 12px; }
.trz-imgtype-icon { font-size: 20px; line-height: 1; float: right; }
.trz-imgtype-label { font-weight: 700; font-size: 13px; color: var(--c-primary); margin-bottom: 3px; }
.trz-imgtype-tagline { font-size: 11px; color: var(--c-text-mute); font-style: italic; margin-bottom: 4px; }
.trz-imgtype-desc { font-size: 11px; color: #888; line-height: 1.45; }
.trz-imgtype-card.selected::after {
    content: "✓"; position: absolute; top: 6px; right: 8px;
    background: var(--c-primary); color: #fff; width: 24px; height: 24px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
}

.trz-samples { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.trz-sample {
    background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-lg);
    overflow: hidden; box-shadow: var(--shadow-sm);
}
.trz-sample img { width: 100%; display: block; }
.trz-sample-body { padding: 10px; text-align: center; }

/* Realism score badge — surfaced from the self-critique loop */
.trz-realism {
    display: inline-block; padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; margin-bottom: 8px;
    text-align: left;
}
.trz-realism-good { background: #e8f5e9; color: #1b5e20; }
.trz-realism-mid  { background: #fff8e1; color: #8a6d00; }
.trz-realism-low  { background: #ffebee; color: #b71c1c; }
.trz-realism-details { margin-top: 6px; font-weight: 400; }
.trz-realism-details summary { cursor: pointer; font-size: 11px; opacity: .85; }
.trz-realism-details summary::-webkit-details-marker { display: none; }
.trz-realism-details ul { margin: 6px 0 4px; padding-left: 18px; font-size: 11.5px; line-height: 1.5; color: #333; }
.trz-realism-details li { margin-bottom: 4px; }
.trz-realism-foot { font-size: 10.5px; color: #666; font-style: italic; margin: 4px 0 0; }

/* Per-sample feedback widgets (studio + library) */
.trz-fb-form { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.trz-fb-rate { display: flex; gap: 6px; justify-content: center; margin-bottom: 4px; }
.trz-fb-btn {
    background: #fff; border: 1px solid var(--c-border); border-radius: 6px;
    padding: 6px 12px; font-size: 16px; cursor: pointer; line-height: 1;
    transition: all .12s ease;
}
.trz-fb-btn:hover { border-color: var(--c-primary); transform: translateY(-1px); }
.trz-fb-up.active   { background: #e8f5e9; border-color: #2e7d32; }
.trz-fb-down.active { background: #ffebee; border-color: #c62828; }
.trz-fb-del:hover   { background: #ffebee; border-color: #c62828; }
.trz-fb-comment {
    width: 100%; box-sizing: border-box; padding: 6px 8px;
    border: 1px solid #cbd5e1; border-radius: 6px; resize: vertical;
    font-size: 12px; font-family: inherit;
}
.trz-btn-sm { font-size: 11.5px; padding: 4px 8px; }

/* Library page */
.trz-libjob { margin-bottom: 18px; }
.trz-libjob-meta {
    display: flex; justify-content: space-between; gap: 18px; align-items: flex-start;
    padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--c-border);
}
.trz-libjob-headline { font-weight: 700; font-size: 15px; color: var(--c-primary); margin-bottom: 4px; }
.trz-libjob-brief { font-size: 12px; color: var(--c-text-mute); line-height: 1.5; }
.trz-libjob-date { font-size: 11px; color: #888; white-space: nowrap; font-family: Menlo, Consolas, monospace; }
/* Library cards: deliberately smaller than Studio sample cards so a job's
   3-up grid fits comfortably on a normal laptop screen. minmax(140px, 200px)
   caps both ends — auto-fit packs as many columns as fit. */
.trz-libjob .trz-samples {
    grid-template-columns: repeat(auto-fill, minmax(140px, 200px));
    gap: 10px;
    justify-content: start;
}
.trz-libjob .trz-sample img { max-height: 200px; object-fit: cover; }
.trz-libjob .trz-sample-body { padding: 8px; }
.trz-libjob .trz-realism { font-size: 11px; padding: 3px 8px; }
.trz-libjob .trz-fb-btn { padding: 4px 8px; font-size: 14px; }
.trz-libjob .trz-fb-comment { font-size: 11.5px; padding: 5px 7px; }

/* Autosave / AJAX status indicator (next to comment box) */
.trz-fb-status { font-size: 11px; color: #888; min-height: 14px; margin-top: 4px; transition: color .15s ease; }
.trz-fb-status-pending { color: #888; font-style: italic; }
.trz-fb-status-ok      { color: #2e7d32; font-weight: 600; }
.trz-fb-status-err     { color: #c62828; font-weight: 600; }
