/* CPS Brand Colors:
   Main:      #5B7E51 (olive green), #6B6A61 (warm gray), #183031 (dark teal)
   Secondary: #D4BB95 (tan/gold), #181E26 (near black)
   Fonts:     Oxanium (headings), Roboto (body)
*/

/* Fonts loaded via <link> in HTML head */

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

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

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
  transition: background-color 0.3s ease;
}

/* === CPS Default Theme (Dark) === */
.theme-cps-dark {
  background: linear-gradient(160deg, #181E26 0%, #183031 50%, #1a2a1e 100%);
  color: #D4BB95;
}

.theme-cps-dark .link-btn {
  background: rgba(91, 126, 81, 0.15);
  border: 1px solid rgba(91, 126, 81, 0.4);
  color: #D4BB95;
}

.theme-cps-dark .link-btn:hover {
  background: rgba(91, 126, 81, 0.3);
  border-color: #5B7E51;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.theme-cps-dark .social-icon {
  color: rgba(212, 187, 149, 0.5);
}

.theme-cps-dark .social-icon:hover {
  color: #D4BB95;
}

.theme-cps-dark .footer a {
  color: rgba(212, 187, 149, 0.3);
}

.theme-cps-dark .footer a:hover {
  color: rgba(212, 187, 149, 0.6);
}

.theme-cps-dark .logo {
  color: #D4BB95;
}

.theme-cps-dark .avatar-placeholder {
  background: rgba(91, 126, 81, 0.25);
  color: #D4BB95;
}

/* === CPS Light Theme === */
.theme-cps-light {
  background: linear-gradient(160deg, #f2ede6 0%, #e8e0d4 50%, #ddd5c7 100%);
  color: #183031;
}

.theme-cps-light .link-btn {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(91, 126, 81, 0.3);
  color: #183031;
}

.theme-cps-light .link-btn:hover {
  background: #fff;
  border-color: #5B7E51;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(24, 48, 49, 0.1);
}

.theme-cps-light .social-icon {
  color: #6B6A61;
}

.theme-cps-light .social-icon:hover {
  color: #5B7E51;
}

.theme-cps-light .footer a {
  color: #6B6A61;
}

.theme-cps-light .logo {
  color: #183031;
}

.theme-cps-light .name {
  color: #183031;
}

.theme-cps-light .title-text {
  color: #5B7E51;
}

.theme-cps-light .avatar-placeholder {
  background: rgba(91, 126, 81, 0.15);
  color: #5B7E51;
}

/* === CPS Tactical Theme === */
.theme-cps-tactical {
  background: linear-gradient(160deg, #181E26 0%, #1c2418 50%, #181E26 100%);
  color: #c8c0b0;
}

.theme-cps-tactical .link-btn {
  background: rgba(91, 126, 81, 0.1);
  border: 1px solid rgba(107, 106, 97, 0.3);
  color: #c8c0b0;
}

.theme-cps-tactical .link-btn:hover {
  background: rgba(91, 126, 81, 0.25);
  border-color: #5B7E51;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.theme-cps-tactical .social-icon {
  color: rgba(200, 192, 176, 0.4);
}

.theme-cps-tactical .social-icon:hover {
  color: #5B7E51;
}

.theme-cps-tactical .footer a {
  color: rgba(200, 192, 176, 0.25);
}

.theme-cps-tactical .logo {
  color: #5B7E51;
}

.theme-cps-tactical .avatar-placeholder {
  background: rgba(91, 126, 81, 0.2);
  color: #5B7E51;
}

/* Container */
.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* Logo */
.logo {
  width: 80px;
  height: auto;
  margin-bottom: 0.25rem;
}

/* Profile */
.profile {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5rem;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  font-family: 'Oxanium', sans-serif;
}

.name {
  font-family: 'Oxanium', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.title-text {
  font-family: 'Oxanium', sans-serif;
  font-size: 0.85rem;
  opacity: 0.7;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.bio {
  font-family: 'Roboto', sans-serif;
  font-size: 0.9rem;
  opacity: 0.6;
  max-width: 400px;
  line-height: 1.6;
  font-weight: 300;
}

/* Links */
.links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.link-btn i {
  font-size: 1.1rem;
  width: 1.2rem;
  text-align: center;
}

/* Social Icons */
.socials {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  flex-wrap: wrap;
}

.social-icon {
  font-size: 1.4rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.social-icon:hover {
  transform: scale(1.15);
}

/* Footer */
.footer {
  margin-top: 1rem;
  padding-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-logo {
  width: 20px;
  height: auto;
}

.footer a {
  text-decoration: none;
  font-family: 'Oxanium', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  transition: opacity 0.2s ease;
}

.footer a:hover {
  opacity: 1;
}

/* Action button row (Share Profile + Add to Contacts) */
.action-btns {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-family: 'Oxanium', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none;
}

.action-btn:hover {
  transform: translateY(-2px);
}

.action-btn i {
  font-size: 1rem;
}

/* Per-theme action button colors */
.theme-cps-dark .action-btn {
  background: rgba(255,255,255,0.08);
  color: #D4BB95;
  border: 1px solid rgba(212,187,149,0.25);
}
.theme-cps-dark .action-btn:hover {
  background: rgba(255,255,255,0.14);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.theme-cps-light .action-btn {
  background: rgba(0,0,0,0.06);
  color: #183031;
  border: 1px solid rgba(0,0,0,0.12);
}
.theme-cps-light .action-btn:hover {
  background: rgba(0,0,0,0.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.theme-cps-tactical .action-btn {
  background: rgba(91,126,81,0.15);
  color: #b5c9a8;
  border: 1px solid rgba(91,126,81,0.35);
}
.theme-cps-tactical .action-btn:hover {
  background: rgba(91,126,81,0.25);
  box-shadow: 0 4px 16px rgba(91,126,81,0.2);
}

/* Share toast (public page feedback) */
.share-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #183031;
  color: #D4BB95;
  border: 1px solid rgba(212,187,149,0.3);
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-family: 'Oxanium', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  transition: opacity 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  white-space: nowrap;
}
.share-toast.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Divider line */
.divider {
  width: 60px;
  height: 2px;
  background: #5B7E51;
  opacity: 0.4;
  border: none;
  margin: 0;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile {
  animation: fadeInUp 0.4s ease-out;
}

.link-btn {
  animation: fadeInUp 0.4s ease-out;
  animation-fill-mode: both;
}

.link-btn:nth-child(1) { animation-delay: 0.05s; }
.link-btn:nth-child(2) { animation-delay: 0.1s; }
.link-btn:nth-child(3) { animation-delay: 0.15s; }
.link-btn:nth-child(4) { animation-delay: 0.2s; }
.link-btn:nth-child(5) { animation-delay: 0.25s; }
.link-btn:nth-child(6) { animation-delay: 0.3s; }
.link-btn:nth-child(7) { animation-delay: 0.35s; }
.link-btn:nth-child(8) { animation-delay: 0.4s; }

.socials {
  animation: fadeInUp 0.4s ease-out 0.45s both;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  body {
    padding: 1.5rem 0.75rem;
  }

  .logo {
    width: 64px;
  }

  .avatar {
    width: 80px;
    height: 80px;
  }

  .name {
    font-size: 1.3rem;
  }

  .link-btn {
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
  }
}

/* Tablet and up */
@media (min-width: 768px) {
  body {
    padding: 3rem 2rem;
    align-items: center;
  }

  .logo {
    width: 96px;
  }

  .avatar {
    width: 110px;
    height: 110px;
  }

  .name {
    font-size: 1.75rem;
  }
}

/* ─── Edit Toolbar (shown to authenticated owners/admins) ─── */
.edit-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(24, 30, 38, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(91, 126, 81, 0.4);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 1000;
  font-family: 'Roboto', sans-serif;
  font-size: 0.85rem;
}

.edit-toolbar-text {
  color: rgba(212, 187, 149, 0.7);
}

.edit-toolbar-text i {
  color: #5B7E51;
  margin-right: 0.25rem;
}

.edit-toolbar-btn {
  color: #D4BB95;
  text-decoration: none;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  background: rgba(91, 126, 81, 0.2);
  border: 1px solid rgba(91, 126, 81, 0.3);
  font-size: 0.8rem;
  transition: all 0.2s;
}

.edit-toolbar-btn:hover {
  background: rgba(91, 126, 81, 0.35);
}

.edit-toolbar-logout {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
}

.edit-toolbar-logout:hover {
  background: rgba(231, 76, 60, 0.3);
}

/* Push content down when toolbar is visible */
body:has(.edit-toolbar) {
  padding-top: calc(2rem + 44px);
}

/* Sign-in link for public pages */
.signin-link {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 100;
}

.signin-link a {
  color: rgba(212, 187, 149, 0.2);
  text-decoration: none;
  font-size: 0.7rem;
  font-family: 'Roboto', sans-serif;
  transition: color 0.2s;
}

.signin-link a:hover {
  color: rgba(212, 187, 149, 0.5);
}
