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

body
{
  margin: 0;
  padding: 0;
  background-color: #121417;
  color: #e6e9ef;
/*   font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; */
  font-family: Verdana, Tahoma, "DejaVu Sans", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a
{
  color: #7cc4fa;
  text-decoration: none;
}

a:hover
{
  text-decoration: underline;
}

.gallery-app
{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Breadcrumbs */
.gallery-header
{
  background-color: #1a1d23;
  border-bottom: 1px solid #2b303b;
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.gallery-header-inner
{
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.gallery-brand a
{
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.gallery-breadcrumbs
{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.95rem;
  color: #9aa5b4;
}

.crumb-sep
{
  color: #52606d;
}

.crumb-current
{
  color: #f5f7fa;
  font-weight: 500;
}

.gallery-user-controls
{
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-user-badge
{
  font-size: 0.85rem;
  color: #9aa5b4;
  background: #242933;
  padding: 4px 10px;
  border-radius: 4px;
}

/* Modern Control Buttons */
.btn-control
{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #e6e9ef;
  background-color: #262b36;
  border: 1px solid #3a4150;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.btn-control:hover
{
  background-color: #323947;
  border-color: #525c70;
  color: #ffffff;
  text-decoration: none;
}

.btn-control.active,
.btn-primary
{
  background-color: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
}

.btn-control.active:hover,
.btn-primary:hover
{
  background-color: #1d4ed8;
}

.btn-close:hover
{
  background-color: #991b1b;
  border-color: #dc2626;
}

/* Main Gallery Grid */
.gallery-main
{
  flex: 1;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

.gallery-grid
{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(var(--thumb-width) + 20px), 1fr));
  gap: 20px;
  justify-items: center;
}

.gallery-card
{
  width: calc(var(--thumb-width) + 20px);
  background-color: #1a1d23;
  border: 1px solid #2b303b;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.gallery-card:hover
{
  transform: translateY(-2px);
  border-color: #4b5563;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  text-decoration: none;
}

.thumb-frame
{
  width: var(--thumb-width);
  height: var(--thumb-height);
  background-color: #0e1013;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.thumb-frame img
{
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
}

.thumb-placeholder
{
  color: #616e7c;
  font-size: 0.85rem;
}

.dir-badge
{
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(18, 20, 23, 0.85);
  color: #7cc4fa;
  border: 1px solid #2b303b;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
}

.thumb-caption
{
  width: 100%;
  margin-top: 8px;
  overflow: hidden;
}

.thumb-title
{
  font-size: 0.875rem;
  font-weight: 600;
  color: #f5f7fa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thumb-desc
{
  font-size: 0.78rem;
  color: #9aa5b4;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-empty,
.gallery-locked-notice
{
  text-align: center;
  padding: 64px 20px;
  color: #9aa5b4;
}

.gallery-footer
{
  text-align: center;
  padding: 16px 24px;
  border-top: 1px solid #2b303b;
  color: #7b8794;
  font-size: 0.82rem;
}

/* Lightbox Overlay */
.lightbox-overlay
{
  position: fixed;
  inset: 0;
  background-color: rgba(10, 12, 15, 0.96);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.lightbox-overlay[hidden]
{
  display: none;
}

.lightbox-toolbar
{
  height: 54px;
  padding: 0 20px;
  background-color: #16191f;
  border-bottom: 1px solid #2b303b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.lightbox-counter
{
  font-size: 0.85rem;
  color: #9aa5b4;
  white-space: nowrap;
}

.lightbox-title
{
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-actions
{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lightbox-workspace
{
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.lightbox-sidebar
{
  width: 300px;
  background-color: #181b22;
  border-right: 1px solid #2b303b;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.lightbox-sidebar[hidden]
{
  display: none;
}

.sidebar-header
{
  padding: 14px 16px;
  border-bottom: 1px solid #2b303b;
}

.sidebar-header h3
{
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
}

.sidebar-body
{
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row
{
  border-bottom: 1px solid #242933;
  padding-bottom: 8px;
}

.info-label
{
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7b8794;
  margin-bottom: 2px;
}

.info-value
{
  font-size: 0.875rem;
  color: #e6e9ef;
  word-break: break-word;
}

.lightbox-stage
{
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
  position: relative;
}

.lightbox-stage.fullsize-mode
{
  align-items: flex-start;
  justify-content: flex-start;
}

.lightbox-img.fit-screen
{
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.65);
}

.lightbox-img.actual-size
{
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  margin: auto;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.65);
}

.lightbox-spinner
{
  position: absolute;
  padding: 10px 18px;
  background: rgba(26, 29, 35, 0.9);
  border: 1px solid #3a4150;
  border-radius: 6px;
  color: #ffffff;
  font-size: 0.9rem;
}

/* Login Modal */
.modal-backdrop
{
  position: fixed;
  inset: 0;
  background-color: rgba(10, 12, 15, 0.88);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop[hidden]
{
  display: none;
}

.modal-dialog
{
  width: 100%;
  max-width: 380px;
  background-color: #1a1d23;
  border: 1px solid #323947;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
}

.modal-dialog h2
{
  margin: 0 0 6px 0;
  font-size: 1.25rem;
  color: #ffffff;
}

.modal-subtitle
{
  margin: 0 0 18px 0;
  color: #9aa5b4;
  font-size: 0.875rem;
}

.modal-error
{
  background-color: rgba(185, 28, 28, 0.2);
  border: 1px solid #dc2626;
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 0.85rem;
}

.form-row
{
  margin-bottom: 14px;
}

.form-row label
{
  display: block;
  margin-bottom: 5px;
  font-size: 0.85rem;
  color: #cbd2d9;
}

.form-row input[type="text"],
.form-row input[type="password"]
{
  width: 100%;
  padding: 9px 12px;
  background-color: #121417;
  border: 1px solid #3a4150;
  border-radius: 6px;
  color: #ffffff;
  font-size: 0.95rem;
}

.form-row input[type="text"]:focus,
.form-row input[type="password"]:focus
{
  outline: none;
  border-color: #3b82f6;
}

.checkbox-label
{
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-actions
{
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.form-actions .btn-control
{
  width: 100%;
  padding: 9px 16px;
}


@media (max-width: 640px)
{
  .lightbox-toolbar
  {
    height: auto;
    min-height: 48px;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .lightbox-title
  {
    order: 3;
    flex-basis: 100%;
    font-size: 0.85rem;
  }

  .lightbox-actions
  {
    gap: 6px;
  }

  .lightbox-actions .btn-control
  {
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  .lightbox-sidebar
  {
    position: absolute;
    inset: 0;
    width: 100%;
    z-index: 10;
  }
}


