:root {
  --navy: #1f3b4d;
  --header-green: #283b32;
  --gold: #9c7a3c;
  --bg: #f6f4f0;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: var(--bg); color: #222; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: #fff; padding: 2.5rem; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.1); width: 320px; }
.login-card h1 { color: var(--navy); margin: 0 0 .25rem; font-size: 1.4rem; }
.login-card .subtitle { color: #777; margin: 0 0 1.5rem; font-size: .9rem; }
.login-card label { display: block; font-size: .85rem; margin: .75rem 0 .25rem; }
.login-card input[type=email], .login-card input[type=password] {
  width: 100%; padding: .6rem; border: 1px solid #ccc; border-radius: 6px;
}
.login-card button {
  margin-top: 1.25rem; width: 100%; padding: .7rem; background: var(--header-green); color: #fff;
  border: none; border-radius: 6px; font-weight: 600; cursor: pointer;
}
.login-card .error { background: #fdeaea; color: #a12b2b; padding: .5rem .75rem; border-radius: 6px; font-size: .85rem; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; background: var(--header-green); color: #fff; }
.topbar h1 { font-size: 1.1rem; margin: 0; }
.user-box { display: flex; align-items: center; gap: 1rem; flex-wrap: nowrap; } .user-box span { white-space: nowrap; } .user-box a { color: #fff; text-decoration: underline; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; padding: 1rem 2rem; background: #fff; border-bottom: 1px solid #ddd; }
.filters input, .filters select { padding: .5rem; border: 1px solid #ccc; border-radius: 6px; }
.filters button { padding: .5rem 1rem; background: var(--gold); color: #fff; border: none; border-radius: 6px; cursor: pointer; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; padding: 1.5rem 2rem; }
.card { display: block; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.08); text-decoration: none; color: inherit; }
.card img { width: 100%; height: 150px; object-fit: cover; display: block; background: #eee; }
.card-body { padding: .6rem .75rem; }
.card-body strong { display: block; color: var(--navy); font-size: .85rem; }
.card-body span { display: block; color: #888; font-size: .75rem; margin: .1rem 0 .3rem; }
.card-body p { margin: 0; font-size: .8rem; color: #444; }

.pagination { text-align: center; padding: 1rem; color: #666; font-size: .85rem; }
.pagination .pg-info { margin-bottom: .5rem; }
.pagination .pg-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem; }
.pagination .pg-buttons button {
  padding: .35rem .7rem; border: 1px solid #ccc; border-radius: 5px; background: #fff;
  color: var(--navy); cursor: pointer; font-size: .85rem; min-width: 2.2rem;
}
.pagination .pg-buttons button:hover:not(:disabled) { background: #f2f2f2; }
.pagination .pg-buttons button.active { background: var(--navy); color: #fff; border-color: var(--navy); cursor: default; }
.pagination .pg-buttons button:disabled:not(.active) { opacity: .4; cursor: default; }
.pagination .pg-ellipsis { padding: 0 .2rem; color: #999; }
.empty { padding: 2rem; text-align: center; color: #888; }

.card-body .tags { font-size: .72rem; color: var(--gold); margin: .2rem 0; }
.edited-badge { font-size: .7rem; color: #888; font-style: normal; }
.review-badge { font-size: .7rem; color: #a12b2b; font-weight: bold; border: 1px solid #a12b2b; border-radius: 4px; padding: 0 .3rem; margin-left: .3rem; }
.wm-choice { display: block; font-size: .7rem; color: #666; margin: .3rem 0 0; }
.wm-choice input { vertical-align: middle; margin-right: .3rem; }

.card-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.card-actions button, .card-actions a {
  flex: 1 1 45%; padding: .35rem; font-size: .75rem; border: 1px solid #ccc; border-radius: 5px;
  background: #f4f4f4; cursor: pointer; text-align: center; text-decoration: none; color: inherit;
}
.btn-download:hover { background: var(--gold); color: #fff; }
.btn-edit:hover { background: var(--navy); color: #fff; }
.btn-delete { color: #a12b2b; border-color: #e3b8b8; }
.btn-delete:hover { background: #a12b2b; color: #fff; }

.edit-form { margin-top: .6rem; border-top: 1px dashed #ddd; padding-top: .6rem; }
.edit-form label { display: block; font-size: .72rem; color: #666; margin-top: .4rem; }
.edit-form select, .edit-form textarea, .edit-form input[type=text] {
  width: 100%; padding: .35rem; border: 1px solid #ccc; border-radius: 5px; font-size: .78rem;
}
.edit-form-buttons { display: flex; gap: .4rem; margin-top: .5rem; }
.edit-form-buttons button { flex: 1; padding: .4rem; border-radius: 5px; border: none; cursor: pointer; font-size: .78rem; }
.btn-guardar { background: var(--navy); color: #fff; }
.btn-cancelar { background: #eee; }

.login-logo { display: block; max-width: 150px; height: auto; margin: 0 auto 0.75rem; }
.topbar h1 { display: flex; align-items: center; gap: 0.6rem; }
.topbar-logo { height: 40px; width: auto; display: block; vertical-align: middle; }

/* Admin menu dropdown (topbar) */
.admin-menu { position: relative; }
.admin-menu-btn { background: transparent; border: 1px solid rgba(255,255,255,0.4); color: #fff; padding: .4rem .8rem; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.admin-menu-btn:hover { background: rgba(255,255,255,0.12); }
.admin-menu-dropdown { display: none; position: absolute; right: 0; top: 130%; background: #fff; color: #222; min-width: 210px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.18); overflow: hidden; z-index: 50; }
.admin-menu:hover .admin-menu-dropdown, .admin-menu:focus-within .admin-menu-dropdown { display: block; }
.admin-menu-dropdown a { display: block; padding: .65rem 1rem; color: #222; text-decoration: none; font-size: .9rem; }
.admin-menu-dropdown a:hover { background: var(--bg); color: var(--header-green); }

/* Admin users page */
.admin-wrap { max-width: 900px; margin: 2rem auto; padding: 0 1.5rem; }
.admin-card { background: #fff; border-radius: 10px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.admin-card h2 { margin-top: 0; color: var(--navy); font-size: 1.15rem; }
.admin-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.admin-form label { display: flex; flex-direction: column; font-size: .8rem; color: #555; gap: .3rem; }
.admin-form input, .admin-form select { padding: .5rem .6rem; border: 1px solid #ddd; border-radius: 6px; font-size: .9rem; min-width: 180px; }
.admin-form button { padding: .55rem 1.1rem; background: var(--header-green); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.admin-form button:hover { opacity: .9; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.admin-table th, .admin-table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid #eee; font-size: .88rem; }
.admin-table th { color: #666; font-weight: 600; font-size: .78rem; text-transform: uppercase; }
.admin-table select { padding: .3rem .4rem; border-radius: 5px; border: 1px solid #ddd; }
.admin-actions { display: flex; gap: .5rem; }
.admin-actions button { padding: .35rem .7rem; border-radius: 5px; border: 1px solid #ddd; background: #fafafa; cursor: pointer; font-size: .82rem; }
.admin-actions button:hover { background: var(--gold); color: #fff; border-color: var(--gold); }
.admin-msg { padding: .6rem .9rem; border-radius: 6px; font-size: .85rem; margin-top: .75rem; }
.admin-msg-ok { background: #e6f4ea; color: #1e6b34; }
.admin-msg-error { background: #fbe7e7; color: #a12727; }
.admin-pw-box { margin-top: .75rem; padding: .75rem 1rem; background: #fff8e1; border: 1px dashed var(--gold); border-radius: 6px; font-family: monospace; font-size: .95rem; word-break: break-all; }
.video-thumb { width: 100%; height: 150px; background: #2a2a2a; color: #fff; display: flex; align-items: center; justify-content: center; font-size: .95rem; gap: .4rem; }

.thumb-wrap { position: relative; width: 100%; height: 150px; background: #eee; overflow: hidden; cursor: pointer; }
.thumb-wrap img { width: 100%; height: 150px; object-fit: cover; display: block; }
.play-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; pointer-events: none;
}

.kind-toggle { display: flex; gap: .5rem; padding: 1rem 2rem 0; }
.kind-btn {
  border: 1px solid #ccc; background: #fff; color: #333;
  padding: .4rem 1rem; border-radius: 999px; cursor: pointer;
  font-size: .9rem;
}
.kind-btn.active { background: var(--header-green, #2f4a3c); color: #fff; border-color: var(--header-green, #2f4a3c); }
.review-toggle { display: flex; align-items: center; gap: .35rem; padding: 1rem 2rem 0; font-size: .9rem; color: #444; cursor: pointer; }

.slug-muted { color: #999; font-size: .78rem; font-family: monospace; }

.new-type-label { margin-top: .3rem; }

.select-mode-toggle { padding: .5rem 1rem; background: #eee; border: 1px solid #ccc; border-radius: 6px; cursor: pointer; }
.select-mode-toggle.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.card-select { position: absolute; top: .4rem; left: .4rem; z-index: 2; background: rgba(255,255,255,.9); border-radius: 4px; padding: .2rem .3rem; display: none; cursor: pointer; }
.selection-mode .card-select { display: flex; }
.card.selected { outline: 3px solid var(--gold); outline-offset: -3px; }
.bulk-bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 2px solid var(--navy); padding: .75rem 2rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; box-shadow: 0 -2px 10px rgba(0,0,0,.12); z-index: 50; }
.bulk-bar select, .bulk-bar input[type="text"] { padding: .4rem; border: 1px solid #ccc; border-radius: 6px; }
.bulk-bar button { padding: .5rem 1rem; border: none; border-radius: 6px; cursor: pointer; }
#bulk-apply { background: var(--navy); color: #fff; }
#bulk-cancel { background: #eee; }
#bulk-select-all { background: var(--gold); color: #fff; }
#bulk-count { font-weight: bold; color: var(--navy); margin-right: .5rem; }

/* Lightbox (visor de fotos y videos en la misma ventana) */
.lightbox {
  position: fixed; inset: 0; background: rgba(10,10,10,.92);
  display: flex; align-items: center; justify-content: safe center; flex-direction: column;
  z-index: 1000; padding: 1.5rem; overflow-y: auto;
}
.lightbox-content { max-width: 92vw; max-height: 62vh; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lightbox-content img, .lightbox-content video {
  max-width: 92vw; max-height: 62vh; object-fit: contain; border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); display: block;
}
.lightbox-close {
  position: absolute; top: 1rem; right: 1.25rem; background: rgba(255,255,255,.15); color: #fff;
  border: none; width: 44px; height: 44px; border-radius: 50%; font-size: 1.7rem; line-height: 1;
  cursor: pointer; z-index: 2;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.15); color: #fff;
  border: none; width: 50px; height: 50px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; z-index: 2;
}
.lightbox-nav:hover { background: rgba(255,255,255,.3); }
.lightbox-nav:disabled { opacity: .25; cursor: default; }
.lightbox-nav:disabled:hover { background: rgba(255,255,255,.15); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-caption { color: #fff; text-align: center; padding: 1rem 1rem 0; max-width: 80vw; flex-shrink: 0; }
.lightbox-info { font-size: .95rem; font-weight: 600; }
.lightbox-download { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: .5rem; flex-shrink: 0; }
.lightbox-download .btn-download { padding: .45rem 1rem; border-radius: 6px; border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1); color: #fff; text-decoration: none; font-size: .85rem; cursor: pointer; }
.lightbox-download .btn-download:hover { background: var(--gold); color: #fff; border-color: var(--gold); }
.lightbox-desc { font-size: .82rem; color: rgba(255,255,255,.75); margin-top: .3rem; max-width: 640px; margin-left: auto; margin-right: auto; }
.lightbox-counter { font-size: .78rem; color: rgba(255,255,255,.5); margin-top: .5rem; }

/* Cuando el formulario de edicion esta abierto, encoger la imagen para dejar
   espacio y evitar que Guardar/Cancelar queden fuera de la vista. */
.lightbox.lightbox-editing .lightbox-content,
.lightbox.lightbox-editing .lightbox-content img,
.lightbox.lightbox-editing .lightbox-content video {
  max-height: 32vh;
}
.lightbox.lightbox-editing .lightbox-desc { display: none; }

@media (max-width: 640px) {
  .lightbox-nav { width: 40px; height: 40px; font-size: 1.1rem; }
  .lightbox-close { width: 38px; height: 38px; font-size: 1.4rem; }
  .lightbox-prev { left: .35rem; }
  .lightbox-next { right: .35rem; }
}

/* Editar / Borrar dentro del lightbox */
.lightbox-actions { display: flex; gap: .5rem; margin-top: .85rem; flex-shrink: 0; }
.lightbox-actions button { padding: .45rem 1.1rem; border-radius: 6px; border: none; cursor: pointer; font-size: .85rem; }
.lightbox-actions .btn-edit { background: rgba(255,255,255,.15); color: #fff; }
.lightbox-actions .btn-edit:hover { background: rgba(255,255,255,.3); }
.lightbox-actions .btn-delete { background: rgba(161,43,43,.85); color: #fff; }
.lightbox-actions .btn-delete:hover { background: #a12b2b; }
.lightbox-actions button:disabled { opacity: .5; cursor: default; }

.lightbox-edit-form {
  margin-top: .85rem; margin-bottom: 1rem; background: #fff; color: #222; border-radius: 8px; padding: 1rem;
  width: min(420px, 90vw); max-height: 45vh; overflow-y: auto; border-top: none; text-align: left;
  flex-shrink: 0;
}
.lightbox-edit-form label { display: block; font-size: .78rem; color: #555; margin-top: .5rem; }
.lightbox-edit-form select, .lightbox-edit-form textarea, .lightbox-edit-form input[type=text] {
  width: 100%; padding: .4rem; border: 1px solid #ccc; border-radius: 5px; font-size: .85rem; margin-top: .2rem;
}
.lightbox-edit-form .edit-form-buttons { margin-top: .75rem; }
