/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'Yekan', 'Tahoma', sans-serif; 
    background-color: #0f172a;
    margin: 0;
    padding: 0;
    background-image: url("./../images/back.jpg"); /* آدرس عکس */
    background-size: cover;       /* پوشش کامل صفحه */
    background-repeat: no-repeat; /* جلوگیری از تکرار */
    background-position: center;  /* قرارگیری وسط */
    background-attachment: fixed; /* ثابت بودن هنگام اسکرول */
    color: #e2e8f0;
    line-height: 1.6; 
}
/* استایل برای المان‌های scale شده */
.scaled-component {
    transition: transform 0.3s ease;
}

/* اطمینان از اینکه المان‌های scale شده در مرکز قرار می‌گیرند */
.live-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* جلوگیری از overflow بعد از scale */
}

/* جلوگیری از scroll در preview */
.live-preview::-webkit-scrollbar {
    display: none;
}

.live-preview {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.container { max-width: 1440px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { 
    background: #1e293bbe;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
    padding: 15px 0; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    border-bottom: 1px solid #334155;
}
.site-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: bold; color: #60a5fa; text-decoration: none; }
.site-header nav ul { list-style: none; display: flex; gap: 20px; }
.site-header nav a { text-decoration: none; color: #cbd5e1; font-weight: 500; transition: color 0.3s; }
.site-header nav a:hover { color: #60a5fa; }
.btn-admin { background: #2563eb; color: #fff !important; padding: 8px 15px; border-radius: 6px; }

/* Main Content */
main { padding: 40px 0; }
.section-header { text-align: center; margin-bottom: 40px; }
.section-header h2 { font-size: 2rem; color: #f8fafc; margin-bottom: 10px; }
.section-header p { color: #94a3b8; }

/* Components Grid - هم‌ترازی ارتفاع کارت‌ها */
.components-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); 
    gap: 10px;
    align-items: stretch; /* همه کارت‌ها در یک سطر ارتفاع یکسان دارند */
}

/* کارت‌ها - ساختار ساده‌شده */
.card { 
    background: #d1d1d14d; /* پیش‌فرض: کارت تیره */
    backdrop-filter: blur(12px);
    border-radius: 12px; 
    overflow: hidden; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.2); 
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s, background 0.3s; 
    display: flex; 
    flex-direction: column; 
    border: 1px solid #334155;
    position: relative;
}
.card:hover { 
    /* transform: translateY(-5px);  */
    box-shadow: 0 10px 25px rgba(0,0,0,0.4); 
    border-color: #475569; 
}

/* حالت کارت روشن (وقتی کامپوننت تیره است) */
.card.light-card {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.card.light-card:hover {
    border-color: #94a3b8;
}

/* حالت کارت تیره (وقتی کامپوننت روشن است) - پیش‌فرض */
.card.dark-card {
    background: #1e293b;
    border-color: #334155;
}

/* پیش‌نمایش - بدون ارتفاع ثابت و بدون اسکرول */
.live-preview { 
    direction: ltr;
    position: relative;
    min-height: 180px; /* حداقل ارتفاع */
    background: transparent; /* شفاف تا بک‌گراند کارت دیده شود */
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 30px 20px 60px 20px; /* فضای بیشتر برای دکمه در پایین */
    flex: 1; /* پر کردن فضای خالی کارت */
}

/* الگوی شطرنجی برای پیش‌نمایش */
.card.dark-card .live-preview {
    background-image: radial-gradient(#334155 1px, transparent 1px);
    background-size: 20px 20px;
}
.card.light-card .live-preview {
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
}

/* دکمه چسبان در پایین سمت راست */
.btn-primary {
    backdrop-filter: blur(4px);
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: #2564eb00; 
    color: #fff; 
    padding: 8px 16px; 
    border-radius: 8px; 
    border: #ffffff46 solid 1px;
    font-weight: 500; 
    text-align: center; 
    transition: all 0.3s; 
    width: auto; 
    text-decoration: none;
    font-size: 0.9rem;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.btn-primary:hover { 
    background: #1d4fd848; 
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.5); 
    /* transform: translateY(-2px); */
}

/* دکمه در کارت روشن */
.card.light-card .btn-primary {
    background: #1e293b;
    color: #f8fafc;
}
.card.light-card .btn-primary:hover {
    background: #334155;
}

/* سایر دکمه‌ها */
.btn { 
    display: inline-block; 
    padding: 10px 20px; 
    border-radius: 8px; 
    text-decoration: none; 
    font-weight: 500; 
    text-align: center; 
    transition: all 0.3s; 
}
.btn-outline { background: transparent; border: 2px solid #3b82f6; color: #3b82f6; }
.btn-outline:hover { background: #3b82f6; color: #fff; }

.explore-section { text-align: center; margin-top: 50px; }
.explore-section .btn { width: auto; padding: 12px 30px; }
.no-components { text-align: center; grid-column: 1 / -1; color: #94a3b8; font-size: 1.2rem; }

/* Footer */
.site-footer { background: #020617; color: #94a3b8; text-align: center; padding: 20px 0; margin-top: 50px; border-top: 1px solid #1e293b; }

/* Filters Bar */
.filters-bar {
  background: #1e293b81;
  backdrop-filter: blur(4px);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  align-items: center;
  border: 1px solid #334155;
}
.filter-group { flex: 1; min-width: 200px; }
.filter-group input, .filter-group select {
  width: 100%;
  padding: 10px 15px;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  color: #e2e8f0;
  outline: none;
  transition: border-color 0.3s;
}
.filter-group input::placeholder, .filter-group select { color: #64748b; }
.filter-group input:focus, .filter-group select:focus { border-color: #3b82f6; }
.filters-bar .btn { width: auto; padding: 10px 20px; margin: 0; }
.results-count { color: #94a3b8; margin-bottom: 20px; font-size: 0.9rem; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
  flex-wrap: wrap;
}
.page-link {
  padding: 8px 14px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  text-decoration: none;
  color: #cbd5e1;
  transition: all 0.3s;
}
.page-link:hover { background: #334155; border-color: #475569; }
.page-link.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

/* Component Detail Page */
.component-detail-page { padding-top: 30px; padding-bottom: 50px; }

.component-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}
.component-header h1 { font-size: 1.8rem; color: #f8fafc; margin-bottom: 8px; }

.preview-section {
  background: #1e293b;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  margin-bottom: 30px;
  border: 1px solid #334155;
}
.section-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: #cbd5e1;
  margin-bottom: 15px;
  border-bottom: 2px solid #334155;
  padding-bottom: 8px;
}
.large-live-preview {
  min-height: 250px;
  background-color: #0f172a;
  background-image: radial-gradient(#334155 1px, transparent 1px);
  background-size: 20px 20px;
  border-radius: 8px;
  border: 1px dashed #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

/* Code Sections & Tabs */
.code-sections { margin-bottom: 30px; }
.code-tabs { display: flex; gap: 5px; margin-bottom: 0; }
.tab-btn {
  padding: 10px 25px;
  background: #334155;
  border: 1px solid #475569;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  color: #cbd5e1;
  transition: all 0.2s;
}
.tab-btn.active {
  background: #1e293b;
  color: #60a5fa;
  border-color: #475569;
  border-bottom: 1px solid #1e293b;
  position: relative;
  z-index: 2;
}

.code-block { display: none; }
.code-block.active { display: block; }

.code-header {
  background: #0f172a;
  color: #94a3b8;
  padding: 10px 15px;
  border-radius: 0 8px 0 0;
  border: 1px solid #334155;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.btn-copy {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-copy:hover { background: rgba(255,255,255,0.15); color: #fff; }

pre {
  margin: 0 !important;
  border-radius: 0 0 8px 8px !important;
  max-height: 400px;
  overflow: auto !important;
  font-family: 'Fira Code', 'Consolas', monospace !important;
  font-size: 0.9rem !important;
  direction: ltr !important;
  text-align: left !important;
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border: 1px solid #334155 !important;
  border-top: none !important;
}

/* Meta Info */
.meta-info {
  display: flex;
  gap: 30px;
  background: #1e293b;
  padding: 20px;
  border-radius: 8px;
  flex-wrap: wrap;
  border: 1px solid #334155;
}
.meta-item { color: #94a3b8; font-size: 0.95rem; }
.meta-item strong { color: #f1f5f9; margin-left: 5px; }