/* Styles extracted from BASE_CSS in frontend.py */
/* Vibrant, interactive theme */
:root{
    --accent-1: #ff6b6b;
    --accent-2: #6b8bff;
    --card-bg: rgba(255,255,255,0.9);
    --muted: #666;
}
html, body { background: linear-gradient(135deg,#0f172a 0%, #0b3d91 50%, #1b9aaa 100%); color: #0b1220; }
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial; margin: 30px; }
a { color: var(--accent-2); }
a:visited { color: #4f6bda; }

h1 { color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.4); letter-spacing: -0.5px }
h2, h3 { color: #f7fbff }
form.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
input[type=text] { width: 360px; padding: 10px 12px; font-size: 16px; border-radius: 8px; border: none; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
select { padding: 8px; font-size: 16px; border-radius: 6px; }
input[type=submit], button, a.button {
    display: inline-block;
    padding: 10px 16px;
    font-size: 15px;
    text-decoration: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}

/* Primary button gradient */
a.button, .button {
    background: linear-gradient(90deg,var(--accent-1), var(--accent-2));
    color: #ffffff !important;
    border: none;
    box-shadow: 0 6px 18px rgba(11,18,32,0.35);
}
a.button:hover, .button:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(11,18,32,0.45); }

/* Secondary button */
a.button.secondary {
    background: rgba(255,255,255,0.1);
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: none;
}
a.button.secondary:hover { background: rgba(255,255,255,0.14); }

.button.disabled { opacity: 0.5; }

/* Responsive grid */
.result-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.thumb { background: var(--card-bg); border-radius: 12px; padding: 10px; position: relative; overflow: hidden; border: 1px solid rgba(0,0,0,0.06); transition: transform .14s ease, box-shadow .14s ease, border-color .12s ease; }
.thumb:hover { transform: translateY(-6px) scale(1.01); box-shadow: 0 18px 40px rgba(2,6,23,0.45); border-color: rgba(0,0,0,0.12); }
.thumb.selected { outline: 3px solid rgba(255,255,255,0.12); box-shadow: 0 22px 48px rgba(11,18,32,0.55), 0 0 0 4px rgba(107,139,255,0.06) inset; }

.thumb img { width: 100%; height: 160px; object-fit: cover; display: block; border-radius: 8px; transition: transform .18s ease, filter .18s ease; }
.thumb img { position: relative; z-index: 1; }
.thumb img.playing { transform: scale(1.03); filter: saturate(115%); }

.meta { font-size: 13px; line-height: 1.3; color: #042032; margin-top: 8px }
.muted { color: var(--muted); font-size: 12px; }

/* checkbox overlay */
.thumb input[type=checkbox] { width: 18px; height: 18px; }
.thumb .checkbox-wrap{ position:absolute; top:10px; right:10px; background: rgba(0,0,0,0.35); padding:6px; border-radius:8px; z-index:60; pointer-events:auto }
.thumb .checkbox-wrap input[type=checkbox]{ width:18px; height:18px; cursor:pointer; }

.pagination { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.pagination .spacer { flex: 1; }
.image-view { display: flex; gap: 20px; align-items: flex-start; margin-top: 10px; }
.image-view img { max-width: 70vw; height: auto; border-radius: 12px; box-shadow: 0 12px 30px rgba(2,6,23,0.45); }
.nav-buttons { display: flex; gap: 10px; margin: 10px 0; }
.breadcrumbs { margin-bottom: 10px; font-size: 14px; color: #e8f3ff; }
.breadcrumbs a { text-decoration: none; color: #dceeff }

@media (max-width:720px){
    .thumb img{ height: 140px }
    input[type=text]{ width: 100%; }
}

/* Lightbox / modal */
.lightbox-overlay{ position:fixed; inset:0; background:rgba(2,6,23,0.75); display:none; align-items:center; justify-content:center; z-index:9999; }
.lightbox-overlay.active{ display:flex; }
.lightbox-card{ max-width:86vw; max-height:86vh; border-radius:12px; overflow:hidden; background:rgba(255,255,255,0.02); box-shadow:0 30px 80px rgba(2,6,23,0.7); }
.lightbox-card img{ display:block; width:100%; height:auto; max-height:86vh; }
.lightbox-close{ position:absolute; top:18px; right:18px; background:rgba(0,0,0,0.45); color:#fff; border-radius:8px; padding:8px; cursor:pointer; border:none; }
/* Prev/Next lightbox nav (position adjusted by JS to sit next to the card) */
.lightbox-nav{ position:absolute; background:rgba(0,0,0,0.65); color:#fff; border:none; width:54px; height:54px; padding:0; border-radius:999px; cursor:pointer; font-size:26px; display:flex; align-items:center; justify-content:center; z-index:100200; box-shadow:0 10px 30px rgba(0,0,0,0.6); pointer-events:auto }
.lightbox-nav:disabled{ opacity:0.28; cursor:default; pointer-events:none }
/* position nav buttons at sides, vertically centered */
.lightbox-nav{ top:50%; transform: translateY(-50%); }
.lightbox-prev{ left: 12px; }
.lightbox-next{ right: 12px; }

/* Combine button animations */
.combine-button { transition: transform .18s ease, box-shadow .18s ease, opacity .12s ease; }
.combine-button.active { transform: translateY(-3px) scale(1.03); box-shadow:0 12px 30px rgba(11,18,32,0.45); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%{ transform: translateY(-2px) scale(1.02);}50%{ transform: translateY(-4px) scale(1.04);}100%{ transform: translateY(-2px) scale(1.02);} }
/* Floating combine bar */
.combine-bar{ position:fixed; left:50%; transform:translateX(-50%); bottom:24px; display:flex; gap:10px; align-items:center; z-index:10001; }
.combine-bar .combine-toggle{ background: linear-gradient(90deg,var(--accent-1), var(--accent-2)); color:#fff; border-radius:10px; padding:8px 12px; border:none; cursor:pointer; min-width:120px; text-align:center; box-shadow:0 8px 24px rgba(11,18,32,0.32); font-weight:600 }
.combine-bar .combine-toggle.active{ transform: translateY(-2px) scale(1.02); box-shadow:0 14px 36px rgba(11,18,32,0.45); }

/* checkboxes always visible */
.thumb .checkbox-wrap{ display:block; }
/* floating combine button always visible */
#floatingCombineBtn{ display:inline-block; }
/* Ensure combine bar sits above other UI */
.combine-bar{ pointer-events:auto; }

/* Lightbox spinner */
.lightbox-spinner{ position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:72px; height:72px; border-radius:50%; display:none; align-items:center; justify-content:center; z-index:100500; }
.lightbox-spinner.visible{ display:flex; }
.lightbox-spinner .dot{ width:52px; height:52px; border-radius:50%; border:6px solid rgba(255,255,255,0.12); border-top-color:rgba(255,255,255,0.9); animation: lb-spin 1s linear infinite; box-shadow:0 6px 20px rgba(0,0,0,0.45); }
@keyframes lb-spin{ from{ transform:rotate(0deg); } to{ transform:rotate(360deg); } }
.lightbox-card{ position:relative; }
.lightbox-card img{ transition: opacity .22s ease; opacity:1; }
.lightbox-card img.failed{ filter:grayscale(60%) opacity(.7); }

/* Edit button on image cards */
.edit-btn {
    display: inline-block;
    font-size: 11px;
    color: #888;
    text-decoration: none;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
    transition: color 0.15s, background 0.15s;
}
.edit-btn:hover {
    color: #fff;
    background: #335599;
}
.delete-img-btn {
    display: inline-block;
    font-size: 11px;
    color: #c00;
    text-decoration: none;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 2px;
    vertical-align: middle;
    transition: color 0.15s, background 0.15s;
}
.delete-img-btn:hover {
    color: #fff;
    background: #c00;
}
.delete-selected-btn {
    background: #c00;
    color: #fff;
    border-color: #900;
    margin-left: 8px;
}
.delete-selected-btn:hover:not([aria-disabled="true"]) {
    background: #900;
}
.delete-selected-btn[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}
