/* Falalu Wedding Gallery - shared mobile-first styles */

:root {
  --primary: #8c5e5b;
  --primary-dark: #6e4c41;
  --accent: #b76e79;
  --danger: #c0392b;
  --success: #27ae60;
  --bg: #f9f6f4;
  --card: #ffffff;
  --text: #4a3b36;
  --muted: #888888;
  --border: #dccfc9;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
  --radius: 14px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 300;
  margin: 0 0 16px;
}

h1 {
  color: var(--primary);
  font-size: 1.9rem;
  text-align: center;
}

h2 {
  color: #5d4a44;
  font-size: 1.3rem;
  border-bottom: 1px solid #e7dcd7;
  padding-bottom: 8px;
  margin-top: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

code {
  background: #f2ebe9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.95em;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

.box {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

/* Auth pages (login, register, profile) */
body.auth {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.auth .container {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.auth .box {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}

.auth .box h2 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 22px;
}

/* Admin login */
.login {
  background: var(--card);
  padding: 30px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.login h2 {
  margin: 0 0 20px;
  text-align: center;
  font-weight: 300;
  color: var(--primary);
}

/* Top / user bars */
.top {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid #efe6e2;
}

.top h1 {
  margin: 0;
  text-align: left;
}

.userbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.userbar a,
.top a {
  color: var(--primary);
  font-weight: 600;
}

.bar a {
  font-weight: 600;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.bar a {
  margin-left: 0;
}

/* Buttons */
.btn, .actions button, button, [type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  min-height: 44px;
  min-width: 44px;
  transition: background 0.2s, transform 0.05s;
  -webkit-appearance: none;
  appearance: none;
}

.btn:hover, button:hover, [type="submit"]:hover {
  background: var(--primary-dark);
}

.btn:active, button:active {
  transform: translateY(1px);
}

.btn.light {
  background: var(--accent);
}

.btn.light:hover {
  background: #9c5d67;
}

button.delete, .btn.delete {
  background: var(--danger);
}

button.delete:hover, .btn.delete:hover {
  background: #a93226;
}

button.extract, .btn.extract {
  background: var(--accent);
}

button.extract:hover, .btn.extract:hover {
  background: #9c5d67;
}

:disabled, button:disabled, .btn:disabled {
  background: #aaa;
  cursor: not-allowed;
}

/* Forms */
label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #5d4a44;
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(183, 110, 121, 0.15);
  outline: none;
}

form.inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

form.inline input[type="text"] {
  flex: 1;
  min-width: 180px;
  margin-bottom: 0;
}

/* Messages */
.msg {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-weight: 500;
}

.msg.success {
  background: #e7f6ef;
  color: var(--success);
}

.msg.error, .error {
  color: var(--danger);
}

.error, .success {
  margin-bottom: 12px;
}

.tip {
  background: #fff9f5;
  border-left: 4px solid var(--accent);
  padding: 14px;
  border-radius: 10px;
  margin-top: 16px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th, td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #f0e8e4;
  word-break: break-word;
}

th {
  background: #f9f4f2;
  color: #5d4a44;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #fdfbfa;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions form {
  display: inline-flex;
  margin: 0;
}

/* Album / photo grids */
.albums, .grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.album, .album-card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: transform 0.15s;
}

.album:hover, .album-card:hover {
  transform: translateY(-3px);
}

.album img, .album-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: #eee;
}

.album .title, .album-card .title {
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

.album-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card {
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.card-actions {
  display: flex;
  align-items: center;
  border-top: 1px solid #f0e8e4;
}

.card-actions a {
  flex: 1;
  text-align: center;
  padding: 12px;
  text-decoration: none;
  color: #6e4c41;
  font-weight: 600;
  font-size: 0.95rem;
  background: #fff;
}

.card-actions a:hover {
  background: #f9f2ef;
}

/* Favorite heart */
.fav {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #c7b8b4;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
  transition: color 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
}

.fav:hover {
  transform: scale(1.1);
}

.fav.active {
  color: #e74c3c;
}

.album-card .fav {
  position: absolute;
  top: 10px;
  right: 10px;
}

.card-actions .fav {
  border-left: 1px solid #f0e8e4;
  border-radius: 0;
  box-shadow: none;
  background: #fff;
}

/* Big upload */
#progress {
  width: 100%;
  height: 32px;
  background: #eee;
  border-radius: 16px;
  overflow: hidden;
  margin-top: 18px;
  display: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

#bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  text-align: center;
  line-height: 32px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: width 0.25s ease-out;
}

#status {
  margin-top: 14px;
  font-size: 0.95rem;
}

#queue {
  margin-top: 18px;
}

.queue-item {
  background: #fff;
  border: 1px solid #e7e0dc;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.queue-hd {
  margin-bottom: 10px;
}

.q-name {
  font-weight: 600;
  word-break: break-all;
  font-size: 1rem;
  line-height: 1.4;
}

.q-size {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 2px;
}

.q-bar-wrap {
  width: 100%;
  height: 28px;
  background: #eee;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 10px;
}

.q-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.2s;
}

.q-status {
  font-size: 0.95rem;
  color: var(--text);
}

.q-status.status-canceled {
  color: #c00;
  font-weight: 600;
}

#dl-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.dl-box {
  background: #fff;
  padding: 28px;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 340px;
  text-align: center;
}

.dl-box p {
  margin: 0 0 14px;
  font-weight: 600;
  color: var(--text);
}

.dl-bar {
  width: 100%;
  height: 14px;
  background: #eee;
  border-radius: 7px;
  overflow: hidden;
}

.dl-ind {
  width: 40%;
  height: 100%;
  background: var(--accent);
  border-radius: 7px;
  animation: dl-move 1.2s infinite linear;
}

@keyframes dl-move {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(300%); }
}

/* Utilities */
.empty {
  text-align: center;
  padding: 30px;
  color: var(--muted);
}

.count {
  font-size: 0.85rem;
  color: var(--muted);
}

.links {
  margin-top: 18px;
  font-size: 0.95rem;
  text-align: center;
}

.links a {
  margin: 0 6px;
}

/* Media queries for larger screens */
@media (min-width: 640px) {
  body {
    padding: 20px;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  .albums, .grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 18px;
  }

  .top {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .userbar {
    margin-bottom: 20px;
  }

  th, td {
    padding: 12px 10px;
  }
}

@media (min-width: 900px) {
  .albums {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }

  .album img, .album-card img, .card img {
    height: 170px;
  }

  .box {
    padding: 24px;
  }
}
