/* ============================================================
   HOMEPAGE - CSS
   Stile dark coerente con DeliveryFlow
   ============================================================ */

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #161822;
  --bg-card: #1c1f2e;
  --bg-hover: #242840;
  --border: #2a2e45;
  --text-primary: #e8eaf0;
  --text-secondary: #8b8fa8;
  --text-muted: #5a5e78;
  --accent: #6c72cb;
  --accent-glow: rgba(108, 114, 203, 0.15);
  --danger: #e74c3c;
  --success: #4caf50;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ===== WRAPPER fullscreen ===== */
.home-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ===== HEADER ===== */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

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

.home-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  font-size: 18px;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.user-logout {
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  transition: all 0.2s;
}
.user-logout:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.home-login-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 6px 16px;
  transition: all 0.2s;
}
.home-login-btn:hover {
  background: var(--accent-glow);
}

/* ===== MAIN ===== */
.home-main {
  flex: 1;
  padding: 40px 24px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

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

.home-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 6px;
  margin-bottom: 32px;
}

/* ===== CARD GRID ===== */
.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.home-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.home-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.home-card:active {
  transform: translateY(0);
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.card-arrow {
  font-size: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s;
}

.home-card:hover .card-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* ===== FOOTER ===== */
.home-footer {
  padding: 14px 24px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ===== TABLET ===== */
@media (min-width: 600px) {
  .home-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-main {
    padding: 60px 32px;
  }

  .home-title {
    font-size: 34px;
  }
}

/* ===== DESKTOP ===== */
@media (min-width: 1024px) {
  .home-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .home-card {
    flex-direction: column;
    text-align: center;
    padding: 32px 24px;
  }

  .card-icon {
    width: 64px;
    height: 64px;
    font-size: 30px;
  }

  .card-arrow {
    display: none;
  }
}

/* ===== TABLET FULLSCREEN (PWA-like) ===== */
@media (max-width: 1024px) and (hover: none) {
  /* iPad / tablet touch */
  html, body {
    height: 100%;
    overflow: hidden;
  }

  .home-wrapper {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .home-header {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}

/* ===== MODAL LOGOUT ===== */
.logout-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.logout-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px 28px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.25s ease;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

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

.logout-modal-icon {
  font-size: 40px;
  margin-bottom: 14px;
}

.logout-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.logout-modal-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 28px;
}

.logout-modal-actions {
  display: flex;
  gap: 10px;
}

.logout-btn-cancel,
.logout-btn-confirm {
  flex: 1;
  padding: 11px 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-align: center;
}

.logout-btn-cancel {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.logout-btn-cancel:hover {
  background: var(--border);
  color: var(--text-primary);
}

.logout-btn-confirm {
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logout-btn-confirm:hover {
  background: #c0392b;
}

/* fix button reset per user-logout */
button.user-logout {
  background: none;
  cursor: pointer;
  font-family: inherit;
}
