/* ========================
   App pages — Cityray Club
   Requiere styles.css cargado primero (hereda variables :root)
   ======================== */

/* Base */
.app-page {
  background: var(--secondary-50);
  min-height: 100vh;
}

/* ========================
   App Navbar
   ======================== */
.app-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.app-navbar .nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.app-navbar .logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.app-navbar .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--white);
}

.app-navbar .logo-text {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.25rem;
  color: var(--white);
  letter-spacing: 0.05em;
}

.app-navbar .nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.app-navbar .nav-links a {
  color: var(--text-subtle);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.app-navbar .nav-links a:hover,
.app-navbar .nav-links a.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  cursor: pointer;
}

.nav-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--white);
}

.btn-signout {
  background: none;
  border: none;
  color: var(--secondary-300);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
}

.btn-signout:hover {
  color: var(--primary);
  background: var(--primary-tint-10);
}

.app-navbar .mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.4rem;
}

/* App main content */
.app-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  padding-top: calc(64px + 2rem);
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-family: 'Bebas Neue', cursive;
  font-size: 2rem;
  color: var(--secondary);
  letter-spacing: 0.03em;
}

/* ========================
   Login page
   ======================== */
.login-page {
  background: var(--secondary);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.5rem;
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--white);
  margin-bottom: 0.25rem;
}

.login-logo-text {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.5rem;
  color: var(--white);
  letter-spacing: 0.08em;
}

.login-card h1 {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.75rem;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.login-card p {
  color: var(--secondary-300);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: var(--white);
  color: var(--text-body);
  font-weight: 600;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-google:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(232, 93, 4, 0.2);
  transform: translateY(-1px);
}

.btn-google:active {
  transform: translateY(0);
}

.btn-google svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.login-divider {
  margin: 1.5rem 0;
  color: var(--secondary-300);
  font-size: 0.8rem;
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.login-back {
  margin-top: 1.5rem;
  font-size: 0.8rem;
}

.login-back a {
  color: var(--secondary-300);
  text-decoration: none;
  transition: color 0.2s;
}

.login-back a:hover {
  color: var(--primary-soft);
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  margin-top: 1rem;
  display: none;
}

.login-error.visible {
  display: block;
}

/* ========================
   Dashboard
   ======================== */
.dashboard-welcome {
  background: var(--secondary);
  border-radius: 1.5rem;
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  color: var(--white);
}

.welcome-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  flex-shrink: 0;
}

.welcome-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.75rem;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.welcome-subtitle {
  color: var(--secondary-300);
  font-size: 0.875rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.dash-card {
  background: var(--white);
  border: 1px solid rgba(203, 213, 225, 0.5);
  border-radius: 1.25rem;
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  transition: all 0.25s cubic-bezier(0.19, 1, 0.22, 1);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-body);
}

.dash-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.15);
  border-color: var(--primary);
}

.dash-card-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-tint-10);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.dash-card h3 {
  font-weight: 700;
  font-size: 1rem;
  color: var(--secondary);
}

.dash-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.dash-card--whatsapp .dash-card-icon {
  background: rgba(37, 211, 102, 0.1);
  color: #25d366;
}

/* Nudge banner */
.nudge-banner {
  background: rgba(232, 93, 4, 0.08);
  border: 1.5px solid var(--primary-tint-15);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  color: var(--primary-dark);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.nudge-banner.hidden {
  display: none;
}

.nudge-banner a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.nudge-banner a:hover {
  text-decoration: underline;
}

/* ========================
   Profile page
   ======================== */
.profile-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 768px) {
  .profile-layout {
    grid-template-columns: 220px 1fr;
  }
}

.profile-avatar-panel {
  background: var(--white);
  border-radius: 1.25rem;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border: 1px solid rgba(203, 213, 225, 0.5);
}

.avatar-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}

.avatar-preview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
}

.avatar-upload-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
  border: 2px solid var(--white);
}

.avatar-upload-btn:hover {
  background: var(--primary-dark);
}

.profile-avatar-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--secondary);
  text-align: center;
}

.profile-avatar-email {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  word-break: break-all;
}

.profile-avatar-uploading {
  font-size: 0.78rem;
  color: var(--primary);
  display: none;
}

.profile-avatar-uploading.visible {
  display: block;
}

.profile-form {
  background: var(--white);
  border-radius: 1.25rem;
  padding: 2rem;
  border: 1px solid rgba(203, 213, 225, 0.5);
}

.form-section {
  margin-bottom: 2.25rem;
}

.form-section:last-of-type {
  margin-bottom: 1.5rem;
}

.form-section h2 {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.3rem;
  color: var(--secondary);
  letter-spacing: 0.03em;
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1.5px solid var(--secondary-50);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-section h2 i {
  color: var(--primary);
  font-size: 1.1rem;
}

.form-group {
  margin-bottom: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--secondary-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.65rem 0.875rem;
  border: 1.5px solid rgba(203, 213, 225, 0.7);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text-body);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint-10);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.username-status {
  font-size: 0.75rem;
  font-weight: 500;
  display: none;
}

.username-status.valid {
  color: #22c55e;
  display: block;
}

.username-status.invalid {
  color: #ef4444;
  display: block;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.save-status {
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
}

.save-status.success {
  color: #22c55e;
  display: block;
}

.save-status.error {
  color: #ef4444;
  display: block;
}

/* Botón primario reutilizable */
.btn-primary-app {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary-app:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(232, 93, 4, 0.3);
}

.btn-primary-app:active {
  transform: translateY(0);
}

.btn-primary-app:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-outline-app {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  background: none;
  color: var(--secondary-400);
  border: 1.5px solid rgba(203, 213, 225, 0.7);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline-app:hover {
  border-color: var(--secondary-400);
  color: var(--secondary);
}

/* ========================
   Members page
   ======================== */
.members-search {
  width: 100%;
  max-width: 360px;
  padding: 0.6rem 1rem;
  border: 1.5px solid rgba(203, 213, 225, 0.7);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--text-body);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.members-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint-10);
}

.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.member-card {
  background: var(--white);
  border-radius: 1.25rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid rgba(203, 213, 225, 0.5);
  transition: all 0.2s;
}

.member-card:hover {
  border-color: var(--primary-tint-15);
  box-shadow: 0 4px 16px -4px rgba(15, 23, 42, 0.1);
  transform: translateY(-2px);
}

.member-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-tint-15);
  flex-shrink: 0;
}

.member-info {
  min-width: 0;
}

.member-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-username {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 500;
}

.member-location {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.2rem;
}

.member-vehicle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Paginación */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.pagination-btn {
  padding: 0.5rem 1rem;
  border: 1.5px solid rgba(203, 213, 225, 0.7);
  border-radius: 8px;
  background: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--secondary-400);
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
}

/* ========================
   Gallery page
   ======================== */
.gallery-grid {
  columns: 2;
  column-gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .gallery-grid {
    columns: 3;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    columns: 4;
  }
}

.gallery-photo-card {
  break-inside: avoid;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
  position: relative;
  cursor: pointer;
  background: rgba(203, 213, 225, 0.3);
}

.gallery-photo-card img {
  width: 100%;
  display: block;
  transition: transform 0.3s;
}

.gallery-photo-card:hover img {
  transform: scale(1.02);
}

.gallery-photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.85) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.875rem;
}

.gallery-photo-card:hover .gallery-photo-overlay {
  opacity: 1;
}

.gallery-photo-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.gallery-photo-author img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.gallery-photo-author span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-photo-caption {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-photo-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 30px;
  height: 30px;
  background: rgba(239, 68, 68, 0.85);
  border: none;
  border-radius: 50%;
  color: var(--white);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-photo-card:hover .gallery-photo-delete {
  opacity: 1;
}

.gallery-photo-delete:hover {
  background: rgba(220, 38, 38, 1);
}

/* ========================
   Modal
   ======================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: var(--white);
  border-radius: 1.5rem;
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-card h2 {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.5rem;
  color: var(--secondary);
  letter-spacing: 0.03em;
  margin-bottom: 1.5rem;
}

.dropzone {
  border: 2px dashed rgba(203, 213, 225, 0.7);
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 1rem;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-tint-10);
}

.dropzone i {
  font-size: 2rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
}

.dropzone p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.dropzone-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: contain;
  display: none;
}

.dropzone-preview.visible {
  display: block;
  margin: 0 auto;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: flex-end;
}

.modal-caption-input {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid rgba(203, 213, 225, 0.7);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-caption-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint-10);
}

/* ========================
   Empty state
   ======================== */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9rem;
  line-height: 1.6;
}

.empty-state.hidden {
  display: none;
}

/* ========================
   Loading skeleton
   ======================== */
.skeleton {
  background: linear-gradient(90deg, rgba(203,213,225,0.4) 25%, rgba(203,213,225,0.2) 50%, rgba(203,213,225,0.4) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.4s infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========================
   Responsive
   ======================== */
@media (max-width: 768px) {
  .app-navbar .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.98);
    flex-direction: column;
    padding: 1rem;
    gap: 0.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .app-navbar .nav-links.open {
    display: flex;
  }

  .app-navbar .nav-links a {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    width: 100%;
  }

  .app-navbar .mobile-menu-btn {
    display: block;
  }

  .nav-user-name {
    display: none;
  }

  .dashboard-welcome {
    flex-direction: column;
    text-align: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
