/*
============================================================
  Crimson Crown - Clans Page Styles (clans.css)
============================================================
  This is the complete, final version. It includes:
  - The new professional design inspired by 'image_e068c9.png'.
  - The fix for the stretching card bug.
*/

.clans-container {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.clans-header {
  text-align: center;
  margin-bottom: 2rem;
}

.clans-header h1 {
  font-size: 3rem;
  color: var(--primary-color);
}

.clans-header p {
  font-size: 1.1rem;
  color: var(--secondary-text);
  max-width: 600px;
  margin: 0.5rem auto 0;
}

/* --- Top Stat Boxes --- */
.clan-stats-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.clan-stat-box {
  background-color: #0F0F0F;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.clan-stat-box i {
  font-size: 2rem;
  color: var(--primary-color);
  background-color: rgba(217, 4, 41, 0.1);
  padding: 1rem;
  border-radius: 8px;
}

.clan-stat-box .stat-info .label {
  font-size: 0.9rem;
  color: var(--secondary-text);
}

.clan-stat-box .stat-info .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-color);
}

/* --- Search & Create Button --- */
.clans-controls {
  display: flex;
  flex-wrap: wrap; /* Allow wrapping on mobile */
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.search-container {
  flex-grow: 1; /* Make search bar take available space */
  max-width: 600px;
  position: relative;
}

#search-clans {
  width: 100%;
  padding: 1rem 1.5rem 1rem 3.5rem;
  font-size: 1rem;
  font-family: var(--font-body);
  background-color: #0F0F0F;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  transition: all 0.3s ease;
}

#search-clans:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(217, 4, 41, 0.3);
}

.search-container i {
  position: absolute;
  top: 50%;
  left: 1.5rem;
  transform: translateY(-50%);
  color: var(--secondary-text);
}

#create-clan-cta-container .btn {
  /* The create button */
  white-space: nowrap; /* Prevent line breaks */
}


/* --- Clan Grid (FIXED) --- */
.clans-grid {
  display: grid;
  
  /* --- THIS IS THE FIX --- */
  /* This tells the grid to create columns that are 
     exactly 320px wide. They will NOT stretch. */
  grid-template-columns: repeat(auto-fit, 320px);
  
  /* This centers the group of cards in the page */
  justify-content: center;
  /* --- END OF FIX --- */
  
  gap: 1.5rem;
}

#clans-loading,
#no-clans-found {
  text-align: center;
  padding: 3rem;
  color: var(--secondary-text);
  font-size: 1.1rem;
  grid-column: 1 / -1;
}
#no-clans-found {
  display: none;
}

/* --- NEW Clan Card (FIXED) --- */
.clan-card {
  background-color: #0F0F0F;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  padding: 1.5rem;
  gap: 1rem; /* Space between sections */
  
  /* --- THIS IS THE FIX --- */
  /* This ensures the card itself never grows */
  width: 320px; 
}

.clan-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border-color: #333;
}

/* 1. Card Header */
.clan-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.clan-card-logo {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  background-color: #050505;
  flex-shrink: 0;
}

.clan-card-name {
  flex: 1;
  min-width: 0;
}

.clan-card-name h3 {
  font-size: 1.25rem;
  color: var(--text-color);
  margin: 0;
  line-height: 1.2;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clan-card-name span {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--secondary-text);
}

/* 2. Card Body */
.clan-card-body {
  font-size: 0.9rem;
  color: var(--secondary-text);
  line-height: 1.6;
  
  /* Truncate long descriptions */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 44px; /* 2 lines of text */
}

/* 3. Card Stats */
.clan-card-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--secondary-text);
  font-weight: 500;
}
.clan-card-stats i {
  color: var(--primary-color);
  margin-right: 0.25rem;
}

/* 4. Card Footer (Buttons) */
.clan-card-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #222;
  display: flex;
  gap: 1rem;
}

.clan-card-footer .btn {
  flex: 1; /* Make buttons share space */
  text-align: center;
  padding: 10px;
  font-size: 0.9rem;
}

