/* Material Design 3 Soft Purple & White Theme for repo.lerio.ir */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
  /* M3 Soft Purple Theme Tokens */
  --md-sys-color-primary: #6750a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eaddff;
  --md-sys-color-on-primary-container: #21005d;
  
  --md-sys-color-secondary: #625b71;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #e8def8;
  --md-sys-color-on-secondary-container: #1d192b;

  --md-sys-color-tertiary: #7d5260;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #ffd8e4;
  --md-sys-color-on-tertiary-container: #31111d;

  --md-sys-color-background: #fef7ff;
  --md-sys-color-on-background: #1d1b20;

  --md-sys-color-surface: #fef7ff;
  --md-sys-color-on-surface: #1d1b20;
  --md-sys-color-surface-variant: #e7e0ec;
  --md-sys-color-on-surface-variant: #49454f;

  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #caccd1;

  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f7f2fa;
  --md-sys-color-surface-container: #f3edf7;
  --md-sys-color-surface-container-high: #ece6f0;
  --md-sys-color-surface-container-highest: #e6e0e9;

  /* Elevation Shadows */
  --md-sys-elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.08), 0px 1px 2px 0px rgba(0, 0, 0, 0.12);
  --md-sys-elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.08), 0px 1px 2px 0px rgba(0, 0, 0, 0.12);
  --md-sys-elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.08), 0px 1px 3px 0px rgba(0, 0, 0, 0.12);
  --md-sys-elevation-4: 0px 6px 10px 4px rgba(0, 0, 0, 0.08), 0px 2px 4px 0px rgba(0, 0, 0, 0.12);

  /* Corner Radii */
  --md-sys-shape-corner-xs: 4px;
  --md-sys-shape-corner-s: 8px;
  --md-sys-shape-corner-m: 12px;
  --md-sys-shape-corner-l: 16px;
  --md-sys-shape-corner-xl: 28px;
  --md-sys-shape-corner-full: 9999px;

  --font-main: 'Vazirmatn', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  line-height: 1.6;
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Material Symbols */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

/* Layout Container */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Top App Bar Header */
.app-header {
  background-color: var(--md-sys-color-surface-container-low);
  border-bottom: 1px solid var(--md-sys-color-surface-variant);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--md-sys-color-on-surface);
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--md-sys-color-primary), #9a82db);
  color: white;
  border-radius: var(--md-sys-shape-corner-m);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--md-sys-elevation-1);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-full);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Hero Section */
.hero-section {
  padding: 48px 0 32px;
  text-align: center;
  background: radial-gradient(circle at 50% 0%, var(--md-sys-color-primary-container) 0%, transparent 70%);
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--md-sys-color-on-surface-variant);
  max-width: 680px;
  margin: 0 auto 32px;
}

/* M3 Search Bar */
.search-container {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}

.m3-search-bar {
  display: flex;
  align-items: center;
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-full);
  padding: 8px 20px;
  box-shadow: var(--md-sys-elevation-1);
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.m3-search-bar:focus-within {
  background: var(--md-sys-color-surface-container-lowest);
  border-color: var(--md-sys-color-primary);
  box-shadow: var(--md-sys-elevation-2);
}

.m3-search-bar input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  color: var(--md-sys-color-on-surface);
}

.m3-search-bar .search-icon {
  color: var(--md-sys-color-on-surface-variant);
}

/* Controls Toolbar (Global Preview Controls) */
.controls-bar {
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-l);
  padding: 16px 24px;
  margin: 24px 0 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--md-sys-elevation-1);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 260px;
}

.control-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
}

.m3-text-input {
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-s);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  width: 100%;
  color: var(--md-sys-color-on-surface);
  outline: none;
  transition: border-color 0.2s ease;
}

.m3-text-input:focus {
  border-color: var(--md-sys-color-primary);
}

.m3-range-slider {
  accent-color: var(--md-sys-color-primary);
  width: 100%;
  cursor: pointer;
}

.size-badge {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  padding: 4px 10px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Category Filter Chips */
.filter-chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 28px;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--md-sys-shape-corner-s);
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface-variant);
  border: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.chip:hover {
  background: var(--md-sys-color-surface-container-high);
}

.chip.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: transparent;
  font-weight: 700;
}

/* Assets Grid & M3 Cards */
.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
  margin-bottom: 64px;
}

.asset-card {
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-l);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.asset-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--md-sys-elevation-2);
  border-color: var(--md-sys-color-primary-container);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title-group h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 2px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-xs);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
}

/* Font Interactive Preview Area */
.preview-area {
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px dashed var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-m);
  padding: 20px;
  margin: 16px 0;
  min-height: 120px;
  display: flex;
  align-items: center;
  overflow-x: auto;
  word-break: break-word;
  transition: all 0.2s ease;
}

.preview-area:focus-within {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-surface);
}

.preview-text {
  outline: none;
  width: 100%;
  color: var(--md-sys-color-on-surface);
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--md-sys-color-surface-variant);
  gap: 12px;
}

/* M3 Buttons */
.m3-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--md-sys-shape-corner-full);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.m3-btn-primary {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-1);
}

.m3-btn-primary:hover {
  background-color: #553e91;
  box-shadow: var(--md-sys-elevation-2);
}

.m3-btn-secondary {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.m3-btn-secondary:hover {
  background-color: #d9cde9;
}

.m3-btn-outlined {
  background-color: transparent;
  border: 1px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-primary);
}

.m3-btn-outlined:hover {
  background-color: var(--md-sys-color-primary-container);
  border-color: var(--md-sys-color-primary);
}

.m3-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-corner-full);
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.m3-icon-btn:hover {
  background-color: var(--md-sys-color-surface-container-highest);
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.m3-dialog {
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-xl);
  padding: 28px;
  width: 100%;
  max-width: 640px;
  box-shadow: var(--md-sys-elevation-3);
  transform: scale(0.92);
  transition: transform 0.25s ease;
}

.modal-overlay.active .m3-dialog {
  transform: scale(1);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.dialog-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.tab-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  margin-bottom: 16px;
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.tab-btn.active {
  color: var(--md-sys-color-primary);
  border-bottom-color: var(--md-sys-color-primary);
}

.code-block {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-m);
  font-family: 'Vazir Code', monospace, monospace;
  font-size: 0.85rem;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  position: relative;
  margin-bottom: 16px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
}

.m3-toast {
  background: var(--md-sys-color-on-surface);
  color: var(--md-sys-color-surface);
  padding: 12px 24px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--md-sys-elevation-3);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.m3-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Footer */
footer {
  margin-top: auto;
  background: var(--md-sys-color-surface-container-low);
  border-top: 1px solid var(--md-sys-color-surface-variant);
  padding: 32px 0;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

footer a {
  color: var(--md-sys-color-primary);
  text-decoration: none;
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero-title {
    font-size: 1.75rem;
  }
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .assets-grid {
    grid-template-columns: 1fr;
  }
}
