/* ---------------- RESET & BASE ---------------- */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: #1b1324;
  color: #ffffff;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* ---------------- GLOBAL LINKS & BUTTONS ---------------- */
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  opacity: 0.8;
}

button {
  cursor: pointer;
  transition: 0.25s;
}

.btn {
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: bold;
  border: none;
  transition: 0.25s ease;
}
.btn:hover {
  transform: translateY(-1px);
}

/* ---------------- HEADER ---------------- */
.app-header {
  background-color: #1b1324;
  border-bottom: 1px solid #2c1f38;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.app-title,
.app-title h1 {
  margin: 0;
  font-size: 22px;
}
.app-title span {
  color: #ff5a3c;
  font-weight: bold;
}

.header-nav {
  display: none;
}
body.logged-in .header-nav {
  display: flex;
  gap: 15px;
}

.header-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ---------------- PROFILE BUTTON ---------------- */
.profile-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #2c1f38;
  overflow: hidden;
  background-color: #2c1f38;
}
.profile-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-weight: bold;
  font-size: 18px;
  color: #ffffff;
}

.profile-menu {
  position: absolute;
  right: 15px;
  top: 70px;
  width: 240px;
  background: #2c1f38;
  border: 1px solid #3a2a4d;
  border-radius: 10px;
  display: none;
  z-index: 10;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.profile-meta {
  padding: 16px;
  border-bottom: 1px solid #3a2a4d;
}

.profile-name {
  font-size: 16px;
  font-weight: bold;
}

.profile-email {
  font-size: 13px;
  color: #cccccc;
}

.menu-item,
.profile-menu button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 14px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  cursor: pointer;
}

.menu-item:hover,
.profile-menu button:hover {
  background: #3a2a4d;
}

.danger {
  color: #ff5a3c !important;
}
.danger:hover {
  background: #ff7b5c !important;
  color: #ffffff !important;
}

/* ---------------- VIDEO ROW ---------------- */
.video-header {
  text-align: center;
  margin-bottom: 5px;
  margin-top: 0;
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
}

.video-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
}

.video-row iframe {
  width: 320px;
  height: 180px;
  border: none;
  border-radius: 8px;
}

/* ---------------- AUTH ---------------- */
#auth {
  width: 100%;
  min-height: 100vh;
  background: #2c1f38;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
}

.auth-wrapper {
  width: 100%;
  max-width: 500px;
  text-align: center;
}

.auth-card {
  background: #1b1324;
  border: 1px solid #3a2a4d;
  padding: 28px;
  border-radius: 10px;
}

.auth-title {
  font-size: 22px;
  margin-bottom: 20px;
  font-weight: 600;
  color: #ffffff;
}

.auth-choice-btn,
.auth-method-btn {
  width: 48%;
  padding: 12px;
  border-radius: 6px;
  border: none;
  background: #3a2a4d;
  color: #ffffff;
  font-size: 16px;
  transition: 0.25s;
}

.auth-choice-btn:hover,
.auth-method-btn:hover {
  background: #ff5a3c;
}

.back-btn {
  background: none;
  border: none;
  color: #cccccc;
  font-size: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.back-btn:hover {
  color: #ff5a3c;
}

input {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  border: 1px solid #3a2a4d;
  border-radius: 6px;
  background: #1b1324;
  color: #ffffff;
}

.auth-submit-btn {
  width: 100%;
  padding: 12px;
  margin-top: 14px;
  border-radius: 6px;
  background: #ff5a3c;
  color: #ffffff;
  font-weight: bold;
}
.auth-submit-btn:hover {
  background: #ff7b5c;
}

.helper {
  margin-top: 10px;
  font-size: 14px;
  color: #cccccc;
}
.helper a {
  color: #ffffff;
}
.helper a:hover {
  color: #ff5a3c;
}

/* ---------------- APP GRID ---------------- */
#app {
  padding: 20px;
}

.app-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 15px;
}

.panel {
  background: #2c1f38;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #3a2a4d;
}

/* ---------------- UPLOAD ---------------- */
.upload-box {
  padding: 20px;
  border: 2px dashed #3a2a4d;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
}
.upload-box:hover {
  background-color: #3a2a4d;
}

/* ---------------- BUTTON ROWS ---------------- */
.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.size-btn,
.convert-buttons button {
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  background: #3a2a4d;
  color: #ffffff;
}
.size-btn.active,
.convert-buttons button.active,
.active {
  background: #ff5a3c !important;
  color: #ffffff !important;
}

/* ---------------- IMAGES ---------------- */
.images {
  display: flex;
  gap: 20px;
}

.image-block {
  width: 100%;
}

.image-label {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.image-container {
  position: relative;
  width: 100%;
  height: 400px;
  background: #1e1628;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #3a2a4d;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder {
  color: #888;
  font-size: 14px;
  text-align: center;
}

.image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ---------------- LOADING OVERLAY ---------------- */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.progress-circle {
  width: 150px;
  height: 150px;
  transform: rotate(-90deg);
}
.progress-circle circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}
.progress-circle .bg {
  stroke: #ddd;
}
.progress-circle .progress {
  stroke: #ff6138;
}

.progress-text {
  color: #ffffff;
  font-size: 28px;
  font-weight: bold;
  transform: translateY(-60px);
}

/* ---------------- WARNING ---------------- */
.warning {
  background: #3a2a4d;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

/* ---------------- FOOTER ---------------- */
footer {
  background: #1b1324;
  border-top: 1px solid #2c1f38;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------------- GALLERY ---------------- */
#userGallery h3 {
  margin-top: 0;
  font-size: 18px;
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.gallery-thumb {
  position: relative;
  width: 100%;
  padding-top: 100%;            /* square */
  border-radius: 8px;
  overflow: hidden;
  background: #1b1324;          /* dark so white line art pops */
  border: 1px solid #3a2a4d;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.gallery-thumb:hover {
  transform: scale(1.05);
}

.gallery-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gallery-style-label {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  pointer-events: none;
}

/* ---------------- LIGHTBOX ---------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 99999;
  display: none; /* default hidden, shown via JS */
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox-img {
  max-width: 90%;
  max-height: 80%;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  cursor: pointer;
  color: #ffffff;
}

.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #2c1f38;
  color: #ffffff;
  padding: 12px 18px;
  border: none;
  border-radius: 6px;
  font-size: 22px;
  cursor: pointer;
}

.lightbox-btn.left {
  left: 20px;
}
.lightbox-btn.right {
  right: 20px;
}

.lightbox-download {
  margin-top: 20px;
  padding: 10px 16px;
  font-weight: bold;
  color: #ffffff;
  background: #ff5a3c;
  border-radius: 6px;
  text-decoration: none;
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 900px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

  .video-row {
    flex-direction: column;
    align-items: center;
  }

  .video-row iframe {
    width: 100%;
  }
}
