/* ==========================================================================
   Custom styles for GAS Website
   Sidebar, cards, and additional components
   ========================================================================== */

/* ==========================================================================
   Sidebar Component
   ========================================================================== */
.sidebar {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px -1px rgba(0, 100, 0, 0.1), 0 2px 4px -2px rgba(0, 100, 0, 0.1);
  overflow: hidden;
}

.sidebar-sticky {
  position: sticky;
  top: 6rem;
}

.sidebar-header {
  background: linear-gradient(135deg, #14532d 0%, #166534 100%);
  color: white;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
}

.sidebar-menu {
  padding: 0.75rem 0;
  margin: 0;
}

.sidebar-menu li {
  margin: 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  padding: 0.625rem 1.25rem;
  color: #374151;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar-item:hover {
  background-color: #f0fdf4;
  color: #15803d;
  border-left-color: #22c55e;
  text-decoration: none;
}

.sidebar-item-active {
  background-color: #f0fdf4;
  color: #15803d;
  border-left-color: #16a34a;
  font-weight: 500;
}

.sidebar-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #e5e7eb, transparent);
  margin: 0.75rem 1.25rem;
}

/* ==========================================================================
   Card Components
   ========================================================================== */
.shadow-card {
  box-shadow: 0 4px 6px -1px rgba(0, 100, 0, 0.1), 0 2px 4px -2px rgba(0, 100, 0, 0.1);
}

/* ==========================================================================
   CKEditor Content Styles
   ========================================================================== */
.ck-content h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

.ck-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

.ck-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
  margin-top: 1.25rem;
}

.ck-content p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.ck-content ul, 
.ck-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.ck-content ul {
  list-style-type: disc;
}

.ck-content ol {
  list-style-type: decimal;
}

.ck-content li {
  margin-bottom: 0.375rem;
}

.ck-content a {
  color: #15803d;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ck-content a:hover {
  color: #166534;
}

.ck-content blockquote {
  border-left: 4px solid #22c55e;
  padding-left: 1rem;
  font-style: italic;
  color: #4b5563;
  margin: 1.5rem 0;
}

.ck-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.ck-content th,
.ck-content td {
  border: 1px solid #e5e7eb;
  padding: 0.75rem;
  text-align: left;
}

.ck-content th {
  background-color: #f0fdf4;
  font-weight: 600;
  color: #14532d;
}

.ck-content tr:nth-child(even) {
  background-color: #f9fafb;
}

/* ==========================================================================
   Contacts Page
   ========================================================================== */
.ck-content .contact-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 0 0 2rem;
}

.ck-content .contact-card {
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  border: 1px solid #dcfce7;
  border-radius: 0.875rem;
  padding: 1rem 1.125rem;
}

.ck-content .contact-card strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #14532d;
}

.ck-content .contact-note {
  color: #4b5563;
  font-size: 0.95rem;
  margin-top: -0.5rem;
  margin-bottom: 1.5rem;
}

.ck-content .contact-table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0 2rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.875rem;
}

.ck-content .contact-table {
  margin: 0;
  min-width: 720px;
}

.ck-content .contact-table thead th,
.ck-content .contact-table .contact-table-title {
  background: linear-gradient(135deg, #14532d 0%, #166534 100%);
  color: #ffffff;
}

.ck-content .contact-table .contact-table-title {
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
  padding: 0.875rem 1rem;
}

.ck-content .contact-table td:last-child,
.ck-content .contact-table th:last-child {
  width: 35%;
}

@media (max-width: 768px) {
  .ck-content .contact-summary {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Gradient Backgrounds
   ========================================================================== */
.bg-gradient-hero {
  background: linear-gradient(135deg, #14532d 0%, #166534 50%, #15803d 100%);
}

/* ==========================================================================
   Mobile Menu
   ========================================================================== */
.mobile-menu[hidden] {
  display: none !important;
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(17, 24, 39, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu.mobile-menu-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-menu-panel {
  width: min(100%, 24rem);
  height: 100%;
  background: #ffffff;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.mobile-menu.mobile-menu-open .mobile-menu-panel {
  transform: translateX(0);
}

@media (min-width: 768px) {
  .mobile-menu {
    display: none !important;
  }
}

/* ==========================================================================
   Scroll to Top Button
   ========================================================================== */
.scroll-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 2.75rem;
  height: 2.75rem;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(1rem);
  transition: all 0.3s ease;
  z-index: 40;
}

.scroll-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.45);
}

.scroll-to-top:active {
  transform: translateY(0);
}

.scroll-to-top-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (max-width: 767px) {
  .scroll-to-top {
    width: 2.5rem;
    height: 2.5rem;
    bottom: 1rem;
    right: 1rem;
  }
}

/* ==========================================================================
   Line Clamp
   ========================================================================== */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Animations
   ========================================================================== */
.fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stagger-1 {
  animation-delay: 0.1s;
}

.stagger-2 {
  animation-delay: 0.2s;
}

.stagger-3 {
  animation-delay: 0.3s;
}

/* ==========================================================================
   Button Components
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: white;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
  box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  box-shadow: 0 6px 8px -1px rgba(22, 163, 74, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: white;
  color: #15803d;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  border: 2px solid #16a34a;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #f0fdf4;
  border-color: #15803d;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1.125rem;
}

.btn-with-icon svg {
  transition: transform 0.2s;
}

.btn-with-icon:hover svg {
  transform: translateX(3px);
}

/* ==========================================================================
   Card Hover Effects
   ========================================================================== */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 100, 0, 0.15), 0 4px 6px -4px rgba(0, 100, 0, 0.1);
}

.card-hoverable {
  transition: all 0.3s ease;
}

.card-hoverable:hover {
  border-color: #22c55e;
}

/* ==========================================================================
   Section Menus
   ========================================================================== */
.section-menu-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.875rem 1rem;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.875rem;
  color: #14532d;
  font-weight: 600;
  box-shadow: 0 4px 6px -1px rgba(0, 100, 0, 0.08), 0 2px 4px -2px rgba(0, 100, 0, 0.08);
}

.section-menu-toggle__label {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.section-menu-toggle__chevron {
  transition: transform 0.2s ease;
}

.section-menu-toggle[aria-expanded="true"] .section-menu-toggle__chevron {
  transform: rotate(180deg);
}

@media (max-width: 1023px) {
  .section-menu-panel {
    display: none;
    margin-bottom: 1.5rem;
  }

  .section-menu-panel.section-menu-panel-open {
    display: block;
  }
}

@media (min-width: 1024px) {
  .section-menu-toggle {
    display: none;
  }
}

/* ==========================================================================
   Documents Page
   ========================================================================== */
.document-filters {
  padding: 0.625rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
}

.document-filter-form {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: end;
}

.document-filter-field {
  min-width: 0;
  flex: 0 1 auto;
}

.document-filter-field-search {
  flex: 1 1 auto;
  min-width: 180px;
  max-width: 280px;
}

.document-filter-field:not(.document-filter-field-search) {
  flex: 0 0 auto;
  width: 130px;
}

.document-filter-actions {
  flex: 0 0 auto;
}

.document-filter-label {
  display: block;
  margin-bottom: 0.125rem;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #6b7280;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.document-filter-input,
.document-filter-form .search-input-field,
.document-filter-form .select,
.document-filter-form .date-input {
  min-height: 2rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  border-radius: 0.375rem;
  width: 100%;
}

.document-filter-form .select-wrapper {
  width: 100%;
}

.document-filter-form .select-arrow {
  width: 14px;
  height: 14px;
  right: 0.5rem;
}

.document-filter-form .search-input-icon {
  width: 0.875rem;
  height: 0.875rem;
  left: 0.75rem;
}

.document-filter-form .search-input-field {
  padding-left: 2.25rem;
}

.document-filter-actions {
  display: flex;
  align-items: end;
}

.document-filter-reset {
  min-height: 2rem !important;
  height: 2rem !important;
  padding: 0.375rem 0.625rem !important;
  font-size: 0.8125rem !important;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Подсветка активных фильтров */
.document-filter-input.has-value,
select.document-filter-input.has-value {
  border-color: #22c55e;
  background-color: #f0fdf4;
}

/* Индикатор активного фильтра */
.filter-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  background: #dcfce7;
  color: #166534;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 999px;
  margin-left: 0.5rem;
}

.document-list {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #ffffff;
}

.document-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem !important;
  border-bottom: 1px solid #f3f4f6;
}

/* Header с датой и номером */
.document-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.document-row__info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.document-row__date {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
}

.document-row__number {
  font-size: 0.75rem;
  font-weight: 600;
  color: #15803d;
  background: #f0fdf4;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

.document-row:last-child {
  border-bottom: 0;
}

.document-row:hover {
  background: #f9fafb;
}

.document-row__main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.document-row__content {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.document-row__title {
  margin: 0 !important;
  font-size: 1rem !important;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-row__title a {
  color: #14532d;
  text-decoration: none;
}

.document-row__title a:hover {
  color: #15803d;
  text-decoration: underline;
}

.document-row__file {
  font-size: 0.6875rem;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
}

.document-row__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.125rem;
}

.document-row__tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.125rem;
  padding: 0.0625rem 0.375rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  background: #ecfdf5;
  color: #166534;
}

.document-row__aside {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}

.document-row__download {
  min-height: 1.75rem !important;
  height: 1.75rem !important;
  padding: 0.25rem 0.625rem !important;
  font-size: 0.75rem !important;
  font-weight: 500;
  box-shadow: none !important;
  border-radius: 0.375rem;
}

@media (max-width: 1023px) {
  .document-filter-form {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .document-filter-field,
  .document-filter-field:not(.document-filter-field-search) {
    flex: 1 1 calc(50% - 0.25rem);
    width: auto;
    min-width: 140px;
  }
  
  .document-filter-field-search {
    flex: 1 1 100%;
    max-width: none;
  }
}

@media (max-width: 767px) {
  .document-filters {
    padding: 0.625rem 0.75rem;
  }

  .document-filter-form {
    flex-direction: column;
  }
  
  .document-filter-field,
  .document-filter-field-search {
    flex: 1 1 100%;
    width: 100%;
  }

  .document-row {
    padding: 0.5rem 0.625rem;
    gap: 0.5rem;
  }
  
  .document-row__header {
    flex-wrap: wrap;
  }
  
  .document-row__info {
    gap: 0.375rem;
  }
  
  .document-row__date,
  .document-row__number {
    font-size: 0.6875rem;
  }
  
  .document-row__content {
    flex-wrap: wrap;
  }
  
  .document-row__title {
    flex: 1 1 100%;
    white-space: normal;
    font-size: 1rem;
  }
  
  .document-row__meta {
    flex-wrap: wrap;
  }

  .document-row__aside {
    gap: 0.375rem;
  }

  .document-row__download {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   Pagination (Compact)
   ========================================================================== */
.pagination-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.pagination-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #111827;
}

.pagination-item-active {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #15803d;
  font-weight: 600;
}

.pagination-item:disabled,
.pagination-item[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}


/* ==========================================================================
   Text Gradient Fix for Yandex Browser
   ========================================================================== */
.text-gradient {
  -webkit-background-clip: text !important;
}

.text-accent-gradient {
  -webkit-background-clip: text !important;
}
