/* ==========================================================================
   ERE Public Member Profile - Mobile-First Responsive Stylesheet
   ========================================================================== */

/* ==========================================================================
   CSS Custom Properties (Themeable Color System)
   ========================================================================== */

.profile-page {
  --profile-primary: #04552c;
  --profile-primary-dark: #023b1e;
  --profile-accent: #800020;
  --profile-bg: #cdd6de;
  --profile-card-bg: #fcfcfc;
  --profile-text: #212529;
  --profile-text-muted: #6c757d;
  --profile-crs-bg: #fffcc4;
  --profile-border-radius: 0.375rem;
  --profile-link-color: var(--profile-primary);
  --profile-link-hover: var(--profile-primary-dark);
  --profile-address-bg: rgba(4, 85, 44, 0.03);
  --profile-card-border: none;
}

/* ==========================================================================
   Base Styles (Mobile First)
   ========================================================================== */

body {
  background-color: var(--profile-bg, #cdd6de);
}

.profile-page {
  min-height: calc(100vh - 58px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1rem;
}

/* ==========================================================================
   Profile Card Container
   ========================================================================== */

.profile-card {
  max-width: 45rem;
  width: 100%;
  background: var(--profile-card-bg);
  color: var(--profile-text);
  border-radius: var(--profile-border-radius);
  border: var(--profile-card-border);
  overflow: hidden;
}

/* ==========================================================================
   Header Section - Agent Identity
   ========================================================================== */

.profile-header {
  padding: 1.25rem;
}

/* Images - stacked and centered on mobile */
.profile-images {
  text-align: center;
  margin-bottom: 1.25rem;
}

.profile-photo,
.profile-logo {
  margin: 0 auto;
}

.profile-photo {
  margin-bottom: 1rem;
}

.profile-photo img,
.profile-logo img {
  max-width: 10rem;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: var(--profile-border-radius);
}

/* Agent Identity - centered on mobile */
.profile-info {
  text-align: center;
}

.profile-info.has-images {
  text-align: left;
}

.agent-identity {
  margin-bottom: 0.5rem;
}

.agent-name {
  font-weight: 800;
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--profile-text);
}

.designations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.35rem 0 0;
}

.designations img {
  max-height: 58px;
  width: auto;
}

.company-name {
  color: var(--profile-accent);
  font-weight: 700;
  font-size: clamp(1.125rem, 4vw, 1.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0.75rem 0;
}

.business-specialty {
  color: var(--profile-text);
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

/* ==========================================================================
   Contact Information
   ========================================================================== */

.contact-info {
  font-style: normal;
  margin-top: 1rem;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  font-weight: 500;
  border: 1px solid var(--profile-link-color);
  color: var(--profile-link-color);
  background-color: transparent;
  border-radius: var(--profile-border-radius);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.contact-link:hover,
.contact-link:focus {
  background-color: var(--profile-link-color);
  color: #fff;
}

.contact-link:focus-visible {
  outline: 2px solid var(--profile-link-color);
  outline-offset: 2px;
}

.phone-numbers {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.phone-item {
  white-space: nowrap;
}

.phone-item abbr {
  text-decoration: none;
  font-weight: 600;
  margin-right: 0.25rem;
}

.phone-item a {
  color: var(--profile-link-color);
  text-decoration: none;
}

.phone-item a:hover,
.phone-item a:focus {
  color: var(--profile-link-hover);
  text-decoration: underline;
}

/* ==========================================================================
   Address Section
   ========================================================================== */

.address-section {
  border-top: 3px solid var(--profile-primary);
  border-bottom: 3px solid var(--profile-primary);
  padding: 0.75rem 1.25rem;
  text-align: center;
  background-color: var(--profile-address-bg);
}

.agent-url {
  margin: 0 0 0.25rem;
}

.agent-url a {
  color: var(--profile-link-color);
  text-decoration: none;
  word-break: break-word;
}

.agent-url a:hover,
.agent-url a:focus {
  color: var(--profile-link-hover);
  text-decoration: underline;
}

.agent-address {
  letter-spacing: 0.04em;
  font-size: 0.9rem;
  color: var(--profile-text);
  margin: 0;
}

/* ==========================================================================
   Content Section
   ========================================================================== */

.profile-content {
  padding: 1.25rem;
  line-height: 1.6;
}

.sub-section {
  margin-bottom: 1rem;
}

.sub-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--profile-text);
  margin: 0;
}

.sub-section h3.d-inline {
  margin-right: 0.35rem;
}

/* Listings Link */
.listings-link {
  margin: 1.25rem 0;
}

.listings-link .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.625rem 1.25rem;
  font-weight: 500;
  background-color: var(--profile-primary);
  color: #fff;
  border: none;
  border-radius: var(--profile-border-radius);
  text-decoration: none;
  transition: background-color 0.2s;
}

.listings-link .btn:hover,
.listings-link .btn:focus {
  background-color: var(--profile-primary-dark);
  color: #fff;
}

.listings-link .btn:focus-visible {
  outline: 2px solid var(--profile-primary);
  outline-offset: 2px;
}

/* Profile Bio */
.profile-bio {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.profile-bio p {
  margin-bottom: 1rem;
}

.profile-bio a {
  color: var(--profile-link-color);
}

.profile-bio a:hover,
.profile-bio a:focus {
  color: var(--profile-link-hover);
}

/* Other Links */
.other-links {
  margin-top: 1.5rem;
}

.other-links h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.other-links li {
  word-break: break-word;
  margin-bottom: 0.35rem;
}

.other-links a {
  color: var(--profile-link-color);
  text-decoration: none;
}

.other-links a:hover,
.other-links a:focus {
  color: var(--profile-link-hover);
  text-decoration: underline;
}

/* ==========================================================================
   Designation Badges
   ========================================================================== */

.designation-badges {
  margin-top: 1.5rem;
  text-align: center;
}

.designation-badges img {
  vertical-align: middle;
  margin: 0.25rem;
  max-height: 58px;
  width: auto;
}

.badge-html {
  display: inline-block;
  margin: 0.25rem;
}

/* ==========================================================================
   CRS/CRB Special Card
   ========================================================================== */

.crea-card {
  margin-top: 1.5rem;
  border: none;
  border-radius: var(--profile-border-radius);
  overflow: hidden;
}

.crea-card .card-body {
  color: var(--profile-accent);
  background-color: var(--profile-crs-bg);
  font-size: 1rem;
  line-height: 1.5;
  padding: 1rem;
}

.crea-card p {
  margin-bottom: 0.75rem;
}

.crea-card p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Tablet Breakpoint (768px / 48rem)
   ========================================================================== */

@media (min-width: 48rem) {
  .profile-page {
    align-items: center;
    padding: 2rem;
  }

  .profile-header {
    padding: 1.5rem 2rem;
  }

  .profile-header > .row {
    justify-content: space-between;
  }

  /* Side-by-side layout for images and info */
  .profile-images {
    text-align: left;
    margin-bottom: 0;
    padding-right: 2rem;
    flex-shrink: 0;
    max-width: 13rem;
  }

  .profile-photo img,
  .profile-logo img {
    max-width: 12rem;
    margin: 0;
  }

  .profile-info {
    padding: 0.5rem 0;
    flex: 1;
    max-width: 24rem;
  }

  .profile-info.has-images {
    text-align: left;
  }

  /* Phone numbers horizontal on tablet+ */
  .phone-numbers {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
  }

  .profile-content {
    padding: 1.5rem;
  }

  .crea-card .card-body {
    font-size: 1.0625rem;
    padding: 1.25rem;
  }
}

/* ==========================================================================
   Desktop Breakpoint (992px / 62rem)
   ========================================================================== */

@media (min-width: 62rem) {
  .profile-page {
    padding: 2rem;
  }

  .crea-card .card-body {
    font-size: 1.125rem;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  body {
    background: none;
  }

  .profile-page {
    padding: 0;
    min-height: auto;
  }

  .profile-card {
    box-shadow: none;
    max-width: none;
    margin: 0;
  }

  .contact-link {
    display: none;
  }

  .profile-photo img,
  .profile-logo img {
    max-width: 8rem;
  }

  .agent-url a::after,
  .other-links a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  .crea-card {
    page-break-inside: avoid;
  }
}

/* Admin View Badge - Fixed Position */
.admin-view-badge {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(220, 53, 69, 0.95);
    color: white;
    padding: 0;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1040;
    display: flex;
    align-items: stretch;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.admin-view-badge .badge-drag-handle {
    display: flex;
    align-items: center;
    padding: 8px 6px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px 0 0 6px;
    cursor: grab;
    color: rgba(255, 255, 255, 0.6);
}

.admin-view-badge .badge-drag-handle:hover {
    background: rgba(0, 0, 0, 0.25);
    color: rgba(255, 255, 255, 0.8);
}

.admin-view-badge .badge-content {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
}

.admin-view-badge .badge-divider {
    opacity: 0.6;
    margin: 0 2px;
}

.admin-view-badge .badge-dismiss {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    transition: background 0.15s, color 0.15s;
}

.admin-view-badge .badge-dismiss:hover {
    background: rgba(0, 0, 0, 0.2);
    color: white;
}
