/* ==========================================
   Рецептус 2.0 - Стили
   ========================================== */

:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --sidebar-width: 320px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f0fdfa 100%);
  min-height: 100vh;
}

/* ==========================================
   Логотип
   ========================================== */

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.logo-text {
  font-weight: 800;
  font-size: 1.4rem;
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 50%, #0891b2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-version {
  font-size: 0.7rem;
  font-weight: 600;
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: white;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 4px;
}

/* ==========================================
   Toast уведомление
   ========================================== */

.toast {
  position: fixed;
  bottom: -200px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  max-width: 420px;
  width: calc(100% - 32px);
  transition: bottom 0.3s ease-out;
}

.toast.show {
  bottom: 24px;
}

.toast-content {
  padding: 16px;
  border-radius: 12px;
  border: 2px solid;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
}

/* ==========================================
   Сайдбар
   ========================================== */

.sidebar {
  width: var(--sidebar-width);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ==========================================
   Карточки препаратов
   ========================================== */

.med-card {
  transition: all 0.2s ease;
  cursor: pointer;
  border-left: 4px solid transparent;
}

.med-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.med-card.active {
  border-left-color: var(--primary);
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.group-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

/* ==========================================
   Кнопки счётчика
   ========================================== */

.counter-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  transition: all 0.15s;
  border: none;
  cursor: pointer;
}

.counter-btn:hover {
  background: #e2e8f0;
  transform: scale(1.05);
}

.counter-btn:active {
  transform: scale(0.95);
}

.counter-btn-primary {
  background: #dbeafe;
  color: #2563eb;
}

.counter-btn-primary:hover {
  background: #bfdbfe;
}

/* ==========================================
   Ссылка на аптеку
   ========================================== */

.pharmacy-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.pharmacy-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* ==========================================
   Форма рецепта
   ========================================== */

.recipe-form {
  background: white;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  overflow: visible;
}

.editable-field {
  background: #fef9c3;
  border-bottom: 1px dashed #eab308;
  padding: 2px 6px;
  cursor: text;
  transition: all 0.2s;
  border-radius: 2px;
}

.editable-field:hover {
  background: #fef08a;
}

.editable-field:focus {
  outline: none;
  background: #fef08a;
  border-bottom: 2px solid #ca8a04;
}

/* ==========================================
   Rx секция
   ========================================== */

.rx-section {
  font-family: 'Times New Roman', Georgia, serif;
}

.rx-line {
  margin: 6px 0;
  font-size: 1.05rem;
}

.rx-label {
  font-weight: bold;
  color: #1e40af;
}

.rx-value {
  color: #1f2937;
}

/* ==========================================
   Плашка "По спецназначению"
   ========================================== */

.special-assignment-banner {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #78350f;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================
   Зона печатей (наложенная)
   ========================================== */

.stamps-overlay {
  position: absolute;
  bottom: 60px;
  right: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 160px;
  justify-content: flex-end;
  pointer-events: none;
}

.stamp-item {
  opacity: 0.7;
}

.stamp-circle {
  width: 50px;
  height: 50px;
  border: 2px dashed #3b82f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
  font-size: 0.55rem;
  text-align: center;
  background: rgba(219, 234, 254, 0.6);
  font-family: 'Inter', sans-serif;
  line-height: 1.1;
}

.stamp-circle.extra {
  border-color: #f59e0b;
  color: #d97706;
  background: rgba(254, 243, 199, 0.6);
}

.stamp-triangle {
  width: 0;
  height: 0;
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  border-bottom: 43px solid rgba(239, 68, 68, 0.15);
  position: relative;
}

.stamp-triangle::before {
  content: '△';
  position: absolute;
  top: 12px;
  left: -8px;
  color: #ef4444;
  font-size: 1.2rem;
}

.stamp-triangle.extra {
  border-bottom-color: rgba(245, 158, 11, 0.15);
}

.stamp-triangle.extra::before {
  color: #d97706;
}

/* ==========================================
   Законы
   ========================================== */

.law-card {
  transition: all 0.2s;
}

.law-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ==========================================
   Футер
   ========================================== */

.footer-link {
  color: #0ea5e9;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #0284c7;
  text-decoration: underline;
}

/* ==========================================
   Скроллбар
   ========================================== */

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================
   Мобильная адаптация
   ========================================== */

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0 !important;
  }
}

@media (max-width: 640px) {
  .recipe-form {
    font-size: 0.9rem;
    margin: 0 8px;
  }
  
  .rx-line {
    font-size: 0.95rem;
  }
  
  .stamps-overlay {
    position: relative;
    bottom: auto;
    right: auto;
    max-width: 100%;
    padding: 16px;
    justify-content: center;
    border-top: 1px dashed #e5e7eb;
  }
  
  .logo-text {
    font-size: 1.2rem;
  }
  
  .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  
  .pharmacy-link {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
  }
}