/* Dashboard-specific styles */
body {
  background-color: #f5f5f5;
  font-family: 'Roboto';
}

.main-dashbaord {
  padding: 1rem;
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
}

.dashboard-sub-container {
  width: 100%;
}

.family-container {
  border-radius: 12px;
  border: 0.3px solid #336DD8;
  padding: 0 30px;
  padding-bottom: 50px;
  background-color: white;
  flex: 1;
  min-width: 300px;
  min-height: 700px;
  margin-left: -28px;
  height: calc(100vh - 2rem);
}
@media (max-height: 740px) {
  .family-container {
    height: auto !important;
  }
}

@media (min-width: 600px) {
  .my-family-header {
    flex-direction: row;
    justify-content: space-between;
  }
}

.my-family-header {
  display: flex;
  align-items: center;
  position: relative;
  justify-content: space-between;
}

.my-family {
  font-size: 32px;
  font-family: "Playfair Display", serif;
  margin-right: 20px;
}

.fam-btn {
  display: flex;
  width: 184px;
  height: 40px;
  font-size: 16px;
  border-radius: 20px;
  background: #0B459C;
  color: white;
  border: none;
  padding: var(--sds-size-space-300);
  justify-content: center;
  align-items: center;
  gap: var(--sds-size-space-200);
  font-family: 'Roboto';
}

.all-btn {
  font-size: 24px;
  background: none;
  border: none;
  margin-left: 50px;
  text-decoration: underline;
}

.info-box {
  position: relative;
  width: 293px;
  height: auto;
  overflow-y: auto;
  border-radius: 12px;
  border: 0.6px solid #ddd;
  background-color: #fff;
  font-family: "Playfair Display", serif;
  align-self: flex-start;
  transition: width 0.3s ease;
  order: 2;
  flex-shrink: 0;
}

.info-box.collapsed {
  width: 70px;
  overflow: hidden;
}

.info-box.collapsed .references-list,
.info-box.collapsed .reference-item,
.info-box.collapsed .reference-meta,
.info-box.collapsed .reference-text,
.info-box.collapsed .refe-text {
  display: none;
}

.materials-nav-toggle {
  display: flex;
  justify-content: flex-start;
  margin: 15px 0 15px 15px;
}

.materials-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  transition: all 0.1s ease;
}

.material-header {
  flex-direction: column;
  border-bottom: 2px solid #eee;
}

.info-box.collapsed .materials-toggle-btn {
  transform: rotate(180deg);
}

.refe-text {
  margin: 15px;
  font-weight: 500;
  font-size: 24px;
  font-family: "Playfair Display", serif;
}

.sub-text {
  font-weight: 400;
  font-size: 20px;
  margin-left: 15px;
  font-family: "Playfair Display", serif;
}

.references-list {
  padding: 15px;
}

.reference-item {
  margin-bottom: 15px;
  padding-bottom: 10px;
}

.reference-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.reference-meta {
  display: flex;
  align-items: center;
  margin-bottom: 2px;
  font-size: 14px;
}

.reference-type {
  color: #666;
  font-weight: 500;
  font-family: 'Roboto';
}

.reference-time {
  color: #999;
  margin-left: 5px;
}

.reference-text {
  font-size: 14px;
  line-height: 1.4;
  color: #333;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  line-clamp: 5;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 10em;
  font-family: 'Roboto';
}

.family-cards {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 20px;
  gap: 20px;
}

.family-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  width: calc(50% - 10px);
  transition: transform 0.2s ease;
}

.family-card {
  display: flex;
  align-items: center;
  padding: 20px;
  border-radius: 12px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.family-icon {
  border: 2px solid;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  min-width: 60px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-right: 20px;
  overflow: hidden;
  flex-shrink: 0;
  aspect-ratio: 1/1;
  box-sizing: border-box;
}

.default-family-icon {
  color: #ffffff;
  font-size: 20px;
}

.family-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.family-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: 0;
  max-width: calc(100% - 80px); /* Subtract icon width and margin */
  overflow: hidden;
}

.family-name {
  font-weight: 400;
  font-size: 20px;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.city-name {
  color: #336dd8;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-content {
  display: flex;
  flex-direction: row;
  padding: 20px;
  gap: 20px;
}

.dashboard-wrapper {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  min-height: 0;
  height: auto;
}

/* Style for pagination with bottom spacing */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  gap: 5px;
}

.pagination-link {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  color: #4a5568;
  text-decoration: none;
  transition: all 0.2s;
}

.pagination-link:hover {
  background-color: #f7fafc;
}

.pagination-link.active {
  background-color: #4299e1;
  color: white;
  border-color: #4299e1;
}

.pagination-ellipsis {
  padding: 8px 12px;
  color: #4a5568;
}

@media (max-width: 768px) {
  .main-dashbaord,
  .dashboard-wrapper,
  .dashboard-content {
    flex-direction: column !important;
    gap: 0 !important;
    padding: 0 !important;
  }

  .family-container {
    min-width: 0;
    min-height: unset;
    margin-left: 0;
    padding: 10px 4vw 30px 4vw;
    height: auto;
    position: relative;
  }

  .info-box {
    position: fixed;
    top: 0;
    right: -100vw;
    width: 85vw;
    height: 100vh;
    max-width: 400px;
    z-index: 2000;
    background: #fff;
    box-shadow: -2px 0 8px rgba(0,0,0,0.15);
    transition: right 0.3s;
    display: block;
    overflow-y: auto;
  }
  .info-box.drawer {
    right: 0;
  }
  .close-materials-drawer {
    display: none;
  }
  .info-box.drawer .close-materials-drawer {
    display: block !important;
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #333;
    z-index: 10;
    cursor: pointer;
  }
  .my-family-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .header-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .my-family {
    font-size: 22px;
    margin-right: 0;
  }
  .materials-fab-mobile {
    display: flex;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: none;
    margin-left: 8px;
    cursor: pointer;
  }
  .materials-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: #fff;
    display: none;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    animation: fadeIn 0.2s;
  }
  .materials-modal.open {
    display: block;
  }
  .materials-modal-content {
    padding: 24px 16px 16px 16px;
    max-width: 600px;
    margin: 0 auto;
  }
  .close-materials-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #333;
    z-index: 10;
    cursor: pointer;
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  .family-cards {
    flex-direction: column;
    gap: 12px;
  }

  .family-card-link {
    width: 100%;
  }

  .family-card {
    flex-direction: row;
    padding: 12px;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px;
  }

  .fam-btn {
    width: 100%;
    min-width: 0;
    font-size: 15px;
    height: 44px;
    padding: 0 24px;
  }
}
@media (min-width: 769px) {
  .close-materials-drawer {
    display: none !important;
  }
}

.materials-fab {
  position: fixed;
  top: 18px;
  right: 16px;
  z-index: 2100;
  background: #0B459C;
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  cursor: pointer;
  border: none;
}
@media (min-width: 769px) {
  .materials-fab {
    display: none !important;
  }
  .materials-fab-mobile,
  .materials-modal {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    position: absolute !important;
    z-index: -1 !important;
  }
}

body.dark-theme{
  background-color: #323232;
}

.dark-theme .family-container {
  background-color: #434343;
}

.dark-theme .my-family{
  color: #E0E0E0;
}
.dark-theme .info-box{
  background-color: #434343;
  border: 0.6px solid #757575;
}
.dark-theme .refe-text{
  color: #E0E0E0;
}
.dark-theme .reference-meta{
  color: #757575;
}
.dark-theme .reference-text{
  color: #DDEAFB;
}
.dark-theme .material-header{
  border-bottom: 1px solid #757575;
}
.dark-theme .pagination-link{
  border: 1px solid #757575;
}
.dark-theme .pagination-link.active{
  background-color: #757575;
  border-color: #757575;
}

.fam-btn[disabled] {
  position: relative;
}

.fam-btn[disabled]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: White;
  color: #336DD8;
  font-family: "Roboto";
  font-size: 14px;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 12px;
  box-shadow: none;
  border: 2px solid;
  border-image-source: linear-gradient(102.36deg, #0245A9 0.89%, #A1C3FA 44.97%, #0245A9 94.78%);
  border-image-slice: 1;
  animation: none;
  transition: none;
}

.fam-btn[disabled]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 12px;
  height: 12px;
  background-color: white;
  border-right: 2px solid #336DD8;
  border-bottom: 2px solid #336DD8;
  transform: translateX(-50%) rotate(45deg);
  margin-bottom: 6px;
  z-index: 1001;
}

.fam-btn[disabled][data-tooltip] {
  transition-delay: 0s !important;
}

.fam-btn[disabled][data-tooltip]:hover {
  transition-delay: 0s !important;
}