/* ============================================================
   style.css — Padlet Live Wall
   Apple/macOS inspired UI — Clean, Modern, Minimal
   ============================================================ */

/* ── Google Fonts Import ────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ── CSS Variables (Light Mode) ─────────────────────────────── */
:root {
  /* Colors */
  --bg-primary:        #efefef;
  --bg-secondary:      #ffffff;
  --bg-navbar:         rgba(255,255,255,0.75);
  --bg-modal:          rgba(0,0,0,0.45);
  --bg-card:           #ffffff;
  --bg-card-hover:     #fafafa;
  --bg-self-card:      #ffffd6;
  --bg-self-card-hover:#fafad1;
  --bg-input:          #f5f5f7;
  --bg-btn-primary:    #1d1d1f;
  --bg-btn-danger:     #ff3b30;
  --bg-btn-admin:      #ff9500;
  --bg-skeleton:       #e8e8e8;
  --bg-skeleton-wave:  #f0f0f0;

  --text-primary:      #1d1d1f;
  --text-secondary:    #6e6e73;
  --text-muted:        #aeaeb2;
  --text-on-dark:      #ffffff;

  --border-color:      rgba(0,0,0,0.08);
  --divider:           rgba(0,0,0,0.06);

  --shadow-card:         0 2px 8px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.04);
  --shadow-card-hover:   0 8px 24px rgba(0,0,0,0.12), 0 0 1px rgba(0,0,0,0.04);
  --shadow-modal:        0 24px 64px rgba(0,0,0,0.20);
  --shadow-navbar:       0 1px 0 rgba(0,0,0,0.08);
  --shadow-btn:          0 2px 8px rgba(0,0,0,0.15);
  --shadow-toast:        0 8px 32px rgba(0,0,0,0.18);

  --radius-card:         18px;
  --radius-btn:          12px;
  --radius-input:        12px;
  --radius-modal:        20px;

  --font-family:         'DM Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;

  --transition-fast:     0.15s ease;
  --transition-med:      0.25s ease;
  --transition-slow:     0.40s cubic-bezier(0.34, 1.56, 0.64, 1);

  --navbar-height:       52px;
}

/* ── Dark Mode Variables ─────────────────────────────────────── */
[data-theme="dark"] {
  --bg-primary:        #1c1c1e;
  --bg-secondary:      #2c2c2e;
  --bg-navbar:         rgba(28,28,30,0.80);
  --bg-card:           #2c2c2e;
  --bg-card-hover:     #3a3a3c;
  --bg-self-card:      #4a4a41;
  --bg-self-card-hover:#58584F;
  --bg-input:          #3a3a3c;
  --bg-btn-primary:    #f5f5f7;
  --bg-skeleton:       #3a3a3c;
  --bg-skeleton-wave:  #48484a;

  --text-primary:      #f5f5f7;
  --text-secondary:    #aeaeb2;
  --text-muted:        #6e6e73;
  --text-on-dark:      #1d1d1f;

  --border-color:      rgba(255,255,255,0.10);
  --divider:           rgba(255,255,255,0.06);

  --shadow-card:         0 2px 8px rgba(0,0,0,0.30), 0 0 1px rgba(0,0,0,0.20);
  --shadow-card-hover:   0 8px 24px rgba(0,0,0,0.40), 0 0 1px rgba(0,0,0,0.20);
  --shadow-modal:        0 24px 64px rgba(0,0,0,0.50);
  --shadow-navbar:       0 1px 0 rgba(255,255,255,0.06);
}

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--bg-navbar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-navbar);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  transition: background 0.3s ease;
}

/* macOS traffic light dots */
.navbar-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: default;
  transition: filter var(--transition-fast);
}
.dot:hover { filter: brightness(0.85); }
.dot-red    { background: #ff5f57; border: 0.5px solid rgba(0,0,0,0.12); }
.dot-yellow { background: #ffbd2e; border: 0.5px solid rgba(0,0,0,0.12); }
.dot-green  { background: #28c840; border: 0.5px solid rgba(0,0,0,0.12); }

/* Navbar title */
.navbar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  pointer-events: none;
}

.navbar-title .folder-icon {
  font-size: 14px;
  opacity: 0.7;
}

/* Navbar right actions */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.btn-icon:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* ── Main Content ─────────────────────────────────────────────── */
.main-content {
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
  padding: 32px 24px 100px;
}

/* ── Board Header ─────────────────────────────────────────────── */
.board-header {
  max-width: 1200px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.board-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.board-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}

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

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  border: none;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: var(--shadow-btn);
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--bg-btn-primary);
  color: var(--text-on-dark);
}
[data-theme="dark"] .btn-primary {
  color: var(--text-on-dark);
}
.btn-primary:hover {
  opacity: 0.82;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}
.btn-primary:active { transform: scale(0.97); }

.btn-danger {
  background: var(--bg-btn-danger);
  color: #fff;
}
.btn-danger:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}
.btn-danger:active { transform: scale(0.97); }

.btn-admin {
  background: var(--bg-btn-admin);
  color: #fff;
}
.btn-admin:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-admin:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  box-shadow: none;
  border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: var(--border-color); }

/* ── Cards Board ─────────────────────────────────────────────── */
.cards-board {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: stretch;
}

/* ── Message Card ────────────────────────────────────────────── */
.message-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px 22px 18px;
  max-width: 100%;
  min-width: 180px;
  min-height: 150px;
  flex-grow: 1;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  cursor: default;
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-med), transform var(--transition-med),
              background var(--transition-med);
  align-self: stretch;

  /* Fade-in animation for new cards */
  animation: cardFadeIn 0.4s cubic-bezier(0.34, 1.20, 0.64, 1) both;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cardFadeOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}

.message-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
  background: var(--bg-card-hover);
}

.message-card:hover .card-delete {
  opacity: 1;
  transform: scale(1);
}

/* Card colored accent top line */
.message-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #007aff, #5856d6);
  opacity: 0;
  transition: opacity var(--transition-med);
}
.message-card:hover::before { opacity: 1; }

.message-card.removing {
  animation: cardFadeOut 0.3s ease forwards;
}

/* Alterations for if the card belongs to the current user */
.self-card {
  background-color: var(--bg-self-card);
}
.self-card:hover { background-color: var(--bg-self-card-hover); }
.self-card::before {
  background: linear-gradient(90deg, #ffcc00, #d6b856);
}
.self-card:hover::before { opacity: 1; }

/* Card title */
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  line-height: 1.3;
  word-break: break-word;
}

/* Card message body */
.card-message {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
  word-break: break-word;
  flex: 1;
}

/* Image on top of card */
.card-image {
  width: calc(100% + 44px);
  margin: -20px -22px 12px;
  overflow: hidden;
  border-top-left-radius: var(--radius-card);
  border-top-right-radius: var(--radius-card);
}
.card-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

/* Card footer */
.card-footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-time {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}

/* Card delete button */
.card-delete {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 59, 48, 0.12);
  color: #ff3b30;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.card-delete:hover {
  background: #ff3b30;
  color: #fff;
  transform: scale(1.1) !important;
}

/* Card removing animation */
.message-card.removing {
  animation: cardRemove 0.3s ease forwards;
}
@keyframes cardRemove {
  to {
    opacity: 0;
    transform: scale(0.90) translateY(8px);
  }
}

/* ── Skeleton Loading Cards ──────────────────────────────────── */
.skeleton-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px 22px 18px;
  width: 220px;
  min-height: 150px;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.skeleton-line {
  background: linear-gradient(
    90deg,
    var(--bg-skeleton) 0%,
    var(--bg-skeleton-wave) 50%,
    var(--bg-skeleton) 100%
  );
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.skeleton-title {
  height: 12px;
  width: 60%;
  margin-bottom: 10px;
}
.skeleton-msg-1 {
  height: 22px;
  width: 85%;
  margin-bottom: 6px;
}
.skeleton-msg-2 {
  height: 22px;
  width: 50%;
  margin-bottom: 20px;
}
.skeleton-time {
  height: 10px;
  width: 40%;
  margin-top: auto;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 80px 20px;
  text-align: center;
  animation: cardFadeIn 0.5s ease;
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 18px;
  opacity: 0.4;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.empty-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 280px;
}

/* ── Modal (Send Message) ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border-color);
  transform: scale(0.93) translateY(12px);
  transition: transform var(--transition-slow);
}

.modal-overlay.visible .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--border-color); }

/* ── Form ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-input,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid transparent;
  border-radius: var(--radius-input);
  padding: 12px 14px;
  font-family: var(--font-family);
  font-size: 15px;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), background var(--transition-fast);
  outline: none;
  resize: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-textarea:focus {
  border-color: #007aff;
  background: var(--bg-secondary);
}

.form-textarea {
  min-height: 100px;
  line-height: 1.5;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ── Admin Modal ─────────────────────────────────────────────── */
.admin-modal .modal { max-width: 360px; }

/* ── Toast Notification ──────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-toast);
  white-space: nowrap;
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both,
             toastOut 0.3s ease 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-success { background: #34c759; }
.toast-error   { background: #ff3b30; }
.toast-info    { background: #007aff; }
.toast-warning { background: #ff9500; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

/* ── Live Indicator ──────────────────────────────────────────── */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #34c759;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34c759;
  animation: livePulse 1.8s ease infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.7); }
}

/* ── Scrollbar (webkit) ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-content { padding: 24px 16px 100px; }

  .board-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .cards-board {
    gap: 12px;
  }

  .message-card {
    flex-shrink: 0;
  }

  .navbar { padding: 0 14px; }

  .navbar-dots { display: none; }

  .card-delete { opacity: 1; transform: scale(1); }
}

@media (max-width: 480px) {
  .message-card {
    width: 100%;
  }

  .board-actions {
    width: 100%;
  }

  .btn { flex: 1; justify-content: center; }

  .modal { padding: 22px 18px; }
}

/* ── Selection ───────────────────────────────────────────────── */
::selection {
  background: rgba(0, 122, 255, 0.2);
  color: var(--text-primary);
}
