/* ===== Guild Progress Badge (Approach 1) ===== */

.guild-badge-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 999;
}

.guild-status-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: #FFFFFF;
  border: 2px solid #D4AF37;
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1F2937;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  position: relative;
}

.guild-status-badge .badge-top-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.guild-status-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: #1F2937;
}

/* Goal achieved state */
.guild-status-badge.achieved {
  background: linear-gradient(135deg, #F4E4B8, #D4AF37);
  animation: glow 2s ease-in-out infinite;
}

/* Warning state (no slack days) */
.guild-status-badge.warning {
  border-color: #F59E0B;
}

/* Green goal met state - border + glow */
.guild-status-badge.green-met {
  border-color: #10B981;
  animation: green-glow 2s ease-in-out infinite;
}

@keyframes green-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.3); }
  50% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.5); }
}

/* Streak color override for achieved (gold) state - burgundy for contrast */
.guild-status-badge.achieved .streak,
.guild-status-badge.achieved .streak span {
  color: #7C2D12;
}

/* Status message text - bottom row */
.badge-status {
  text-align: center;
  font-size: 0.7rem;
  color: #6B7280;
  font-weight: 500;
  padding-top: 0.25rem;
  border-top: 1px solid #E5E7EB;
  width: 100%;
}

.guild-status-badge.achieved .badge-status {
  color: #7C2D12;
  border-top-color: rgba(124, 45, 18, 0.2);
}

/* Badge sections */
.badge-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
}

.badge-label {
  font-size: 0.625rem;
  font-weight: 500;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-divider {
  width: 1px;
  height: 1.5rem;
  background: #E5E7EB;
}

.progress-text {
  color: #1F2937;
  font-variant-numeric: tabular-nums;
}

.streak {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #F59E0B;
}

/* Pulse animation for in-progress state */
.pulse-dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px rgba(212, 175, 55, 0.3); }
  50% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.6); }
}

/* Tooltip */
.guild-tooltip {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: #1F2937;
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  pointer-events: none;
}

.guild-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 1rem;
  border: 6px solid transparent;
  border-bottom-color: #1F2937;
}

.guild-status-badge:hover .guild-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Banner badge (hidden by default) */
.guild-banner-badge {
  display: none;
}

/* Desktop: Show badge, hide banner (>1300px) */
@media (min-width: 1301px) {
  .guild-badge-container {
    display: block;
  }
  .guild-banner-badge {
    display: none !important;
  }
}

/* Tablet & Mobile: Hide badge, show banner (≤1300px) */
@media (max-width: 1300px) {
  .guild-badge-container {
    display: none;
  }

  .guild-banner-badge {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: sticky;
    top: 0; /* Default: at top for tablet+ viewports */
    width: 100%;
    padding: 0.5rem 1rem;
    border-radius: 0;
    border: none;
    border-bottom: 2px solid #D4AF37;
    background: #FFFFFF;
    z-index: 1030; /* Below mobile header (1040) */
    animation: slideInTop 0.3s ease-out;
  }

  .guild-banner-badge .badge-top-row {
    display: contents;
  }

  .guild-banner-badge .badge-section {
    flex-direction: row;
    gap: 0.25rem;
  }

  .guild-banner-badge .badge-label {
    display: inline;
    font-size: 0.75rem;
    text-transform: none;
  }

  .guild-banner-badge .badge-divider {
    width: 1px;
    height: 1rem;
    background: #E5E7EB;
  }

  .guild-banner-badge .badge-status {
    border-top: none;
    padding-top: 0;
    width: auto;
    order: -1;
    font-size: 0.75rem;
  }

  .guild-banner-badge .badge-status-divider {
    display: block;
    width: 1px;
    height: 1rem;
    background: #E5E7EB;
    order: -1;
  }

  @keyframes slideInTop {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
}

/* Mobile: Position below mobile header and hide when sidebar is open (≤768px) */
@media (max-width: 768px) {
  .guild-banner-badge {
    top: 42px; /* Position below mobile header */
  }

  .sidebar.show ~ .content-with-sidebar .guild-banner-badge,
  body:has(.sidebar.show) .guild-banner-badge {
    display: none;
  }
}

/* ===== Original Guild Progress Card (to be removed) ===== */

.guild-progress-root {
    margin-bottom: 1.5rem;
}

.guild-progress-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #dbe1ea;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
    padding: 1.25rem 1.5rem;
    color: #0f172a;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.guild-progress-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.gp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.gp-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.gp-expand-btn-inline {
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    background: rgba(37, 99, 235, 0.12);
}

.gp-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.gp-streak {
    font-size: 0.95rem;
    color: #2563eb;
    font-weight: 500;
}

.gp-bar {
    position: relative;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    background: rgba(148, 163, 184, 0.35);
}

.gp-bar-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.35), rgba(148, 163, 184, 0.55));
}

.gp-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: linear-gradient(90deg, #22c55e 0%, #facc15 100%);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.gp-marker {
    position: absolute;
    top: -6px;
    width: 2px;
    height: 24px;
    background: rgba(15, 23, 42, 0.35);
}

.gp-marker-green {
    background: #22c55e;
}

.gp-marker-gold {
    background: #facc15;
}

.gp-goals {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 0.75rem;
}

.gp-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.gp-slack {
    font-weight: 500;
    color: #0f172a;
}

.gp-cta {
    background: #2563eb;
    border: none;
    color: #ffffff;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gp-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

.gp-cta:focus {
    outline: 2px solid rgba(37, 99, 235, 0.4);
    outline-offset: 2px;
}

.gp-reset {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.gp-week-calendar {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.gp-week-row {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
}

.gp-week-body {
    align-items: stretch;
}

.gp-week-header {
    font-size: 0.75rem;
    text-transform: uppercase;
}

.gp-weekday {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.gp-weekday-date {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}

.gp-week-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
    background: rgba(226, 232, 240, 0.6);
    min-height: 56px;
    position: relative;
    text-align: left;
    color: #0f172a;
    font-weight: 600;
}

.gp-week-date {
    font-size: 0.9rem;
    line-height: 1;
    font-weight: 700;
}

.gp-week-count {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 0.35rem;
    line-height: 1;
}

.gp-week-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.1rem;
}

.gp-week-label:empty {
    display: none;
}

.gp-week-empty {
    font-size: 0.85rem;
    color: #94a3b8;
}

.gp-grid-gold {
    background: rgba(250, 204, 21, 0.25);
    color: #92400e;
}

.gp-grid-met {
    background: rgba(34, 197, 94, 0.2);
    color: #166534;
}

.gp-grid-slack {
    background: rgba(59, 130, 246, 0.18);
    color: #1d4ed8;
}

.gp-grid-missed {
    background: rgba(239, 68, 68, 0.2);
    color: #b91c1c;
}

.gp-grid-in-progress {
    background: rgba(37, 99, 235, 0.15);
    color: #1d4ed8;
}

.gp-grid-no-data,
.gp-grid-pending {
    background: rgba(148, 163, 184, 0.18);
    color: #475569;
}

.gp-grid-today {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.45);
}

.gp-heatmap-wrapper {
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.gp-heatmap-months {
    display: grid;
    gap: 0.35rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.gp-heatmap {
    display: grid;
    gap: 0.35rem;
    align-items: center;
}

.gp-heatmap-count {
    font-size: 0.75rem;
    font-weight: 600;
}

.gp-heatmap-cell {
    min-width: 22px;
    min-height: 22px;
    border-radius: 6px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
}

.gp-heatmap-header {
    font-size: 0.7rem;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
}

.gp-heatmap-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
}

.gp-heatmap-day {
    background: rgba(226, 232, 240, 0.5);
    cursor: pointer;
}

.gp-heatmap-icon {
    font-size: 0.85rem;
    font-weight: 600;
}

.gp-heatmap-empty {
    background: rgba(226, 232, 240, 0.25);
    color: #94a3b8;
    cursor: default;
}

.gp-heatmap-outside {
    background: transparent;
    color: transparent;
    pointer-events: none;
}

.gp-heatmap-corner {
    background: transparent;
}

.gp-expand {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gp-expand-inline {
    margin-top: 0.5rem;
}

.gp-expand-btn {
    border: none;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.45rem 1rem;
    cursor: pointer;
    align-self: flex-start;
}

.gp-expand-btn:hover {
    background: rgba(37, 99, 235, 0.18);
}

.gp-expand-grid {
    display: block;
}

.guild-progress-pill {
    position: sticky;
    top: 64px;
    z-index: 15;
    width: 100%;
    display: none;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(37, 99, 235, 0.8));
    color: #ffffff;
    border-radius: 999px;
    padding: 0.55rem 1.1rem;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
    font-weight: 600;
    cursor: pointer;
}

.guild-progress-pill:focus {
    outline: 2px solid #ffffff;
    outline-offset: 4px;
}

.pill-meter {
    font-size: 0.9rem;
}

.pill-copy {
    font-size: 0.85rem;
    opacity: 0.9;
}

.guild-progress-drawer {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 2rem 1rem 1.5rem;
    z-index: 1050;
}

.guild-progress-drawer[hidden] {
    display: none;
}

.guild-progress-drawer-inner {
    width: min(500px, 100%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.guild-progress-drawer .guild-progress-card {
    width: 100%;
    margin-bottom: 0;
}

.guild-progress-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    margin-bottom: 0.75rem;
}

.drawer-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.drawer-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    border-radius: 999px;
    width: 36px;
    height: 36px;
    cursor: pointer;
}

.drawer-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

@media (max-width: 767px) {
    .guild-progress-card[data-surface="desktop"] {
        display: none;
    }

    .guild-progress-pill {
        display: flex;
        margin-bottom: 1rem;
    }
}

@media (min-width: 768px) {
    .guild-progress-root {
        position: sticky;
        top: 1.25rem;
        z-index: 12;
    }

    .guild-progress-card[data-surface="desktop"] .gp-expand {
        display: block;
    }

    .guild-progress-card[data-surface="drawer"] {
        display: none;
    }

    .guild-progress-drawer {
        display: none !important;
    }
}

@media (max-width: 499px) {
    .guild-progress-drawer {
        align-items: flex-end;
        padding: 0;
    }

    .guild-progress-drawer-inner {
        width: 100%;
        margin: 0;
        border-radius: 24px 24px 0 0;
        background: #ffffff;
        padding: 1.5rem 1.25rem 2rem;
        box-shadow: 0 -18px 40px rgba(15, 23, 42, 0.18);
        max-height: 92vh;
        overflow-y: auto;
        gap: 1.25rem;
    }

    .guild-progress-drawer-header {
        color: #0f172a;
        margin-bottom: 0.25rem;
    }

    .drawer-title {
        font-size: 1.2rem;
        font-weight: 700;
    }

    .drawer-close {
        background: rgba(148, 163, 184, 0.2);
        color: #0f172a;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .guild-progress-drawer .guild-progress-card {
        flex: 1 1 auto;
        border-radius: 20px;
        min-height: 280px;
    }
}
