/**
 * shared-decks.css
 * Styling for Phase 4: Study Partners & Shared Collaborative Decks
 */

/* Shared Deck Card styling */
.shared-deck-card {
  border-left: 4px solid #3273dc;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shared-deck-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

/* Dual Comparative Progress Widget */
.shared-progress-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.75rem;
}

.shared-progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shared-progress-label {
  font-size: 0.72rem;
  font-weight: 600;
  width: 44px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.shared-progress-row .study-progress-thin {
  top: 0;
  height: 16px;
  width: 82px;
  border-radius: 4px;
  overflow: hidden;
}

.shared-progress-row .study-progress-thin:before {
  font-size: 0.68em;
  top: 1px;
  line-height: 14px;
  font-weight: 700;
}

.shared-progress-user .value {
  background-color: #4a90e2 !important;
}

.shared-progress-partner .value {
  background-color: #23d160 !important;
}

/* Shared Deck Card Column Layout */
.shared-deck-card .shared-deck-study-col {
  min-width: 140px;
}

.shared-deck-card .shared-deck-study-col .study-progress-thin {
  width: 82px;
}

.shared-deck-card .shared-deck-info-col {
  min-width: 0;
  flex: 1 1 auto;
}

.shared-deck-card .shared-deck-action-col {
  flex-shrink: 0;
  text-align: right;
}

.shared-deck-card .shared-deck-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.shared-deck-card .shared-deck-tag {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
}

/* Responsive adjustments for shared deck cards on narrow screens */
@media screen and (max-width: 768px) {
  .shared-deck-card .card-content {
    padding: 0.75rem 0.6rem;
  }

  /* Reduce width of progress area */
  .shared-deck-card .shared-deck-study-col {
    min-width: 98px;
    padding: 0.5rem 0.25rem 0.5rem 0.5rem;
  }

  .shared-deck-card .shared-progress-container {
    gap: 2px;
  }

  .shared-deck-card .shared-progress-row {
    gap: 4px;
  }

  /* Reduce width available for text labels 'You:' and study partner */
  .shared-deck-card .shared-progress-label {
    width: 32px;
    font-size: 0.68rem;
  }

  /* Reduce width available for the two progress bars */
  .shared-deck-card .shared-progress-row .study-progress-thin,
  .shared-deck-card .shared-deck-study-col .study-progress-thin {
    width: 58px;
    height: 14px;
  }

  .shared-deck-card .shared-progress-row .study-progress-thin:before {
    font-size: 0.62em;
    top: 0;
    line-height: 14px;
  }

  /* Reduce area available to the middle block of information */
  .shared-deck-card .shared-deck-info-col {
    min-width: 0;
    padding: 0.5rem 0.25rem;
  }

  .shared-deck-card .shared-deck-info-col p[id^="sharedDeckName"] {
    font-size: 1.05rem !important;
    line-height: 1.25;
    word-break: break-word;
    margin-bottom: 0.15rem;
  }

  .shared-deck-card .shared-deck-info-col p[id^="sharedDeckCount"] {
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
  }

  .shared-deck-card .shared-deck-tags {
    gap: 3px;
    margin-top: 0.2rem;
  }

  .shared-deck-card .shared-deck-tag {
    font-size: 0.68rem;
    height: 1.6em;
    padding-left: 0.45em;
    padding-right: 0.45em;
    max-width: 100%;
  }

  /* Keep dropdown arrow icon positioned within the border of the card panel, on the right-hand side */
  .shared-deck-card .shared-deck-action-col {
    flex-shrink: 0;
    padding: 0.5rem 0.5rem 0.5rem 0.25rem;
    text-align: right;
  }
}

@media screen and (max-width: 480px) {
  .shared-deck-card .card-content {
    padding: 0.6rem 0.45rem;
  }

  .shared-deck-card .shared-deck-study-col {
    min-width: 86px;
    padding: 0.35rem 0.2rem 0.35rem 0.35rem;
  }

  .shared-deck-card .shared-progress-label {
    width: 28px;
    font-size: 0.64rem;
  }

  .shared-deck-card .shared-progress-row .study-progress-thin,
  .shared-deck-card .shared-deck-study-col .study-progress-thin {
    width: 50px;
    height: 13px;
  }

  .shared-deck-card .shared-progress-row .study-progress-thin:before {
    font-size: 0.58em;
    line-height: 13px;
  }

  .shared-deck-card .shared-deck-info-col {
    padding: 0.35rem 0.2rem;
  }

  .shared-deck-card .shared-deck-info-col p[id^="sharedDeckName"] {
    font-size: 0.95rem !important;
    line-height: 1.2;
  }

  .shared-deck-card .shared-deck-info-col p[id^="sharedDeckCount"] {
    font-size: 0.68rem;
  }

  .shared-deck-card .shared-deck-tag {
    font-size: 0.64rem;
    height: 1.5em;
    padding-left: 0.35em;
    padding-right: 0.35em;
  }

  .shared-deck-card .shared-deck-action-col {
    padding: 0.35rem 0.35rem 0.35rem 0.15rem;
  }
}

/* On page widths under 425px, allow a more compact dropdown menu button to keep it safely within border */
@media screen and (max-width: 424px) {
  .shared-deck-card .shared-deck-action-col .button {
    padding: calc(0.35em - 1px) 0.5em;
    height: auto;
  }
}

/* Circular badge for partner counter button */
.partner-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  text-align: center;
}

.partner-badge.is-info {
  background-color: #3273dc;
  color: #fff;
}

.partner-badge.is-danger {
  background-color: #f14668;
  color: #fff;
}

/* Partner Modal Styling */
.partner-invite-box {
  background-color: #282f2f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.partner-invite-box .title,
.partner-invite-title {
  color: #fff;
}

.partner-card-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0.75rem;
  background-color: #2c3238;
  color: #fff;
  transition: background-color 0.15s ease;
}

.partner-card-item:hover {
  background-color: #353c43;
}

.partner-card-main {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1 1 240px;
  min-width: 0;
}

.partner-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3273dc 0%, #00d1b2 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.partner-details {
  flex: 1 1 auto;
  min-width: 0;
}

.partner-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  margin-bottom: 0.2rem;
  word-break: break-word;
}

.partner-email-line {
  font-size: 0.8rem;
  color: #b5b5b5;
  margin-bottom: 0.35rem;
  word-break: break-all;
}

.partner-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.partner-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

@media screen and (max-width: 520px) {
  .partner-card-item {
    padding: 0.75rem;
  }
  .partner-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 0.25rem;
  }
}

.partner-meta {
  font-size: 0.75rem;
  color: #b5b5b5;
}

/* Dark mode overrides (fallback for themes specifying class on body/html) */
.theme-dark .shared-deck-card,
body.theme-dark .shared-deck-card {
  border-left-color: #00d1b2;
}

.theme-dark .partner-card-item,
body.theme-dark .partner-card-item {
  background-color: #2c3238;
  border-color: rgba(255, 255, 255, 0.12);
}

.theme-dark .partner-card-item:hover,
body.theme-dark .partner-card-item:hover {
  background-color: #353c43;
}

.theme-dark .shared-progress-status,
body.theme-dark .shared-progress-status {
  color: #48c78e;
}

/* Responsive invite fields wrapping on mobile */
.partner-invite-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.partner-invite-fields > .control {
  margin-right: 0 !important;
  margin-bottom: 0 !important;
}

.partner-invite-fields .control-email {
  flex: 1 1 200px;
  max-width: 280px;
}

.partner-invite-fields .control-rel {
  flex: 0 1 auto;
}

.partner-invite-fields .control-btn {
  flex: 0 0 auto;
}

/* Edit deck total progress flex alignment */
.deck-total-progress {
  display: inline-flex;
  align-items: center;
}

@media screen and (max-width: 520px) {
  .partner-invite-fields {
    flex-direction: column;
    align-items: stretch;
  }
  .partner-invite-fields .control,
  .partner-invite-fields .control-email,
  .partner-invite-fields .control-rel,
  .partner-invite-fields .control-btn {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
  .partner-invite-fields .select,
  .partner-invite-fields select,
  .partner-invite-fields button {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Selected count and deck count badge transitions */
#selected_cards_count,
#flashcard_deck_count {
  transition: all 0.2s ease-in-out;
}



