/* ==========================================================================
   Auth UI Component Styles
   Shared Google Sign-In Module
   
   BEM naming convention:
     Block: .auth-widget
     Elements: .auth-widget__sign-in-btn, .auth-widget__profile, etc.
     Modifiers: .auth-widget--hidden, .auth-widget__sign-in-btn--loading, etc.
   
   CSS Custom Properties for theming — override these on a parent element
   or :root to customize the appearance.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Custom Properties (Theming)
   -------------------------------------------------------------------------- */
:root {
  /* General */
  --auth-font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --auth-font-size: 14px;
  --auth-border-radius: 4px;
  --auth-transition-duration: 0.2s;
  --auth-focus-ring-color: rgba(66, 133, 244, 0.5);
  --auth-focus-ring-width: 3px;

  /* Sign-in button (Google brand) */
  --auth-signin-bg: #ffffff;
  --auth-signin-bg-hover: #f8f9fa;
  --auth-signin-bg-active: #f1f3f4;
  --auth-signin-text-color: #3c4043;
  --auth-signin-border-color: #dadce0;
  --auth-signin-height: 40px;
  --auth-signin-padding: 0 12px;
  --auth-signin-font-weight: 500;
  --auth-signin-shadow: 0 1px 2px rgba(60, 64, 67, 0.1);
  --auth-signin-shadow-hover: 0 1px 3px rgba(60, 64, 67, 0.2);

  /* Profile display */
  --auth-profile-avatar-size: 32px;
  --auth-profile-name-color: #202124;
  --auth-profile-name-font-weight: 500;
  --auth-profile-gap: 8px;

  /* Sign-out button */
  --auth-signout-bg: transparent;
  --auth-signout-bg-hover: #f1f3f4;
  --auth-signout-bg-active: #e8eaed;
  --auth-signout-text-color: #5f6368;
  --auth-signout-border-color: #dadce0;
  --auth-signout-height: 36px;
  --auth-signout-padding: 0 16px;
  --auth-signout-font-weight: 500;

  /* Widget layout */
  --auth-widget-gap: 12px;
}

/* --------------------------------------------------------------------------
   Block: .auth-widget
   -------------------------------------------------------------------------- */
.auth-widget {
  display: inline-flex;
  align-items: center;
  gap: var(--auth-widget-gap);
  font-family: var(--auth-font-family);
  font-size: var(--auth-font-size);
}

.auth-widget--hidden {
  display: none;
}

/* --------------------------------------------------------------------------
   Element: Sign-In Button (Google-branded)
   -------------------------------------------------------------------------- */
.auth-widget__sign-in-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--auth-signin-height);
  padding: var(--auth-signin-padding);
  background-color: var(--auth-signin-bg);
  color: var(--auth-signin-text-color);
  border: 1px solid var(--auth-signin-border-color);
  border-radius: var(--auth-border-radius);
  font-family: var(--auth-font-family);
  font-size: var(--auth-font-size);
  font-weight: var(--auth-signin-font-weight);
  line-height: 1;
  letter-spacing: 0.25px;
  cursor: pointer;
  box-shadow: var(--auth-signin-shadow);
  transition:
    background-color var(--auth-transition-duration) ease,
    box-shadow var(--auth-transition-duration) ease;
  user-select: none;
  white-space: nowrap;
}

.auth-widget__sign-in-btn:hover {
  background-color: var(--auth-signin-bg-hover);
  box-shadow: var(--auth-signin-shadow-hover);
}

.auth-widget__sign-in-btn:active {
  background-color: var(--auth-signin-bg-active);
  box-shadow: none;
}

.auth-widget__sign-in-btn:focus-visible {
  outline: var(--auth-focus-ring-width) solid var(--auth-focus-ring-color);
  outline-offset: 2px;
}

.auth-widget__sign-in-btn:disabled,
.auth-widget__sign-in-btn--loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Google "G" logo icon within the sign-in button */
.auth-widget__sign-in-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-widget__sign-in-icon svg {
  width: 18px;
  height: 18px;
}

/* Sign-in button label text */
.auth-widget__sign-in-text {
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Element: User Profile Display
   -------------------------------------------------------------------------- */
.auth-widget__profile {
  display: inline-flex;
  align-items: center;
  gap: var(--auth-profile-gap);
}

.auth-widget__profile--hidden {
  display: none;
}

/* Circular avatar */
.auth-widget__avatar {
  width: var(--auth-profile-avatar-size);
  height: var(--auth-profile-avatar-size);
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Fallback avatar (when no image available) */
.auth-widget__avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--auth-profile-avatar-size);
  height: var(--auth-profile-avatar-size);
  border-radius: 50%;
  background-color: #e8eaed;
  color: #5f6368;
  font-size: calc(var(--auth-profile-avatar-size) * 0.5);
  font-weight: 500;
  flex-shrink: 0;
}

/* User display name */
.auth-widget__name {
  color: var(--auth-profile-name-color);
  font-weight: var(--auth-profile-name-font-weight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* --------------------------------------------------------------------------
   Element: Sign-Out Button
   -------------------------------------------------------------------------- */
.auth-widget__sign-out-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--auth-signout-height);
  padding: var(--auth-signout-padding);
  background-color: var(--auth-signout-bg);
  color: var(--auth-signout-text-color);
  border: 1px solid var(--auth-signout-border-color);
  border-radius: var(--auth-border-radius);
  font-family: var(--auth-font-family);
  font-size: var(--auth-font-size);
  font-weight: var(--auth-signout-font-weight);
  line-height: 1;
  cursor: pointer;
  transition:
    background-color var(--auth-transition-duration) ease,
    border-color var(--auth-transition-duration) ease;
  user-select: none;
  white-space: nowrap;
}

.auth-widget__sign-out-btn:hover {
  background-color: var(--auth-signout-bg-hover);
}

.auth-widget__sign-out-btn:active {
  background-color: var(--auth-signout-bg-active);
}

.auth-widget__sign-out-btn:focus-visible {
  outline: var(--auth-focus-ring-width) solid var(--auth-focus-ring-color);
  outline-offset: 2px;
}

.auth-widget__sign-out-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Element: Error Message
   -------------------------------------------------------------------------- */
.auth-widget__error {
  color: #d93025;
  font-size: 12px;
  margin-top: 4px;
}

.auth-widget__error--hidden {
  display: none;
}

/* --------------------------------------------------------------------------
   Responsive: Compact layout on small screens
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .auth-widget {
    gap: 8px;
  }

  .auth-widget__name {
    max-width: 100px;
  }

  .auth-widget__sign-in-btn {
    padding: 0 8px;
  }

  .auth-widget__sign-out-btn {
    padding: 0 12px;
  }
}
