/* ==========================================
   Open Banking DR - Общие стили
   СТО БР ФАПИ.СЕК-1.6-2024
   ========================================== */

:root {
  /* Основная цветовая палитра */
  --ob-primary: #1e40af;
  --ob-primary-light: #3b82f6;
  --ob-primary-dark: #1e3a8a;
  --ob-secondary: #64748b;
  --ob-success: #059669;
  --ob-success-light: #10b981;
  --ob-warning: #d97706;
  --ob-warning-light: #f59e0b;
  --ob-danger: #dc2626;
  --ob-info: #0891b2;
  
  /* Фоны и карточки */
  --ob-bg-light: #f8fafc;
  --ob-bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --ob-card-bg: #ffffff;
  --ob-border-color: #e2e8f0;
  
  /* Тёмная тема */
  --ob-dark-bg: #1e1f22;
  --ob-dark-card: #2a2b30;
  --ob-dark-border: #41444a;
  --ob-dark-text: #eef2f7;
  --ob-dark-text-muted: #c7ccd4;
  
  /* Текст */
  --ob-text-primary: #1e293b;
  --ob-text-secondary: #64748b;
  --ob-text-muted: #94a3b8;
  
  /* Тени */
  --ob-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --ob-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --ob-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --ob-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Радиусы */
  --ob-radius-sm: 6px;
  --ob-radius-md: 8px;
  --ob-radius-lg: 12px;
  --ob-radius-xl: 16px;
  
  /* Навигация */
  --ob-sidebar-width: 280px;
  --ob-navbar-height: 60px;
}

/* ==========================================
   Базовые стили
   ========================================== */

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  color: var(--ob-text-primary);
  background: var(--ob-bg-gradient);
  min-height: 100vh;
}

body.dark-theme {
  background: var(--ob-dark-bg);
  color: var(--ob-dark-text);
}

/* ==========================================
   Навигация - Сайдбар
   ========================================== */

.ob-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--ob-sidebar-width);
  height: 100vh;
  background: var(--ob-card-bg);
  border-right: 1px solid var(--ob-border-color);
  box-shadow: var(--ob-shadow-md);
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.dark-theme .ob-sidebar {
  background: var(--ob-dark-card);
  border-color: var(--ob-dark-border);
}

.ob-sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--ob-border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dark-theme .ob-sidebar-header {
  border-color: var(--ob-dark-border);
}

.ob-sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ob-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ob-sidebar-logo:hover {
  color: var(--ob-primary-light);
}

.dark-theme .ob-sidebar-logo {
  color: var(--ob-primary-light);
}

.ob-sidebar-nav {
  padding: 1rem 0;
}

.ob-nav-section {
  margin-bottom: 1rem;
}

.ob-nav-section-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ob-text-muted);
}

.dark-theme .ob-nav-section-title {
  color: var(--ob-dark-text-muted);
}

.ob-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--ob-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.ob-nav-link:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--ob-primary);
  border-left-color: var(--ob-primary-light);
}

.ob-nav-link.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--ob-primary);
  border-left-color: var(--ob-primary);
  font-weight: 600;
}

.dark-theme .ob-nav-link {
  color: var(--ob-dark-text-muted);
}

.dark-theme .ob-nav-link:hover,
.dark-theme .ob-nav-link.active {
  background: rgba(59, 130, 246, 0.2);
  color: var(--ob-primary-light);
}

.ob-nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.ob-nav-badge {
  margin-left: auto;
  padding: 0.125rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--ob-primary-light);
  color: white;
}

/* ==========================================
   Контент с сайдбаром
   ========================================== */

.ob-content-wrapper {
  margin-left: var(--ob-sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.ob-content-wrapper.collapsed {
  margin-left: 0;
}

/* Мобильная адаптация */
@media (max-width: 991px) {
  .ob-sidebar {
    transform: translateX(-100%);
  }
  
  .ob-sidebar.open {
    transform: translateX(0);
  }
  
  .ob-content-wrapper {
    margin-left: 0;
  }
  
  .ob-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }
  
  .ob-sidebar.open + .ob-sidebar-overlay {
    display: block;
  }
}

/* ==========================================
   Верхний тулбар
   ========================================== */

.ob-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ob-border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dark-theme .ob-toolbar {
  background: rgba(42, 43, 48, 0.95);
  border-color: var(--ob-dark-border);
}

.ob-toolbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--ob-text-primary);
  cursor: pointer;
  padding: 0.25rem;
}

@media (max-width: 991px) {
  .ob-toolbar-toggle {
    display: block;
  }
}

.dark-theme .ob-toolbar-toggle {
  color: var(--ob-dark-text);
}

.ob-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--ob-text-secondary);
}

.ob-breadcrumb a {
  color: var(--ob-primary);
  text-decoration: none;
}

.ob-breadcrumb a:hover {
  text-decoration: underline;
}

/* ==========================================
   Карточки
   ========================================== */

.ob-card {
  background: var(--ob-card-bg);
  border-radius: var(--ob-radius-xl);
  box-shadow: var(--ob-shadow-lg);
  border: 1px solid var(--ob-border-color);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.dark-theme .ob-card {
  background: var(--ob-dark-card);
  border-color: var(--ob-dark-border);
}

.ob-card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--ob-border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dark-theme .ob-card-header {
  border-color: var(--ob-dark-border);
}

.ob-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ob-card-body {
  padding: 1.5rem;
}

.ob-card-accent {
  position: relative;
}

.ob-card-accent::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.ob-card-accent.primary::before {
  background: linear-gradient(90deg, var(--ob-primary), var(--ob-primary-light));
}

.ob-card-accent.success::before {
  background: linear-gradient(90deg, var(--ob-success), var(--ob-success-light));
}

.ob-card-accent.warning::before {
  background: linear-gradient(90deg, var(--ob-warning), var(--ob-warning-light));
}

/* ==========================================
   Формы
   ========================================== */

.ob-form-label {
  font-weight: 600;
  color: var(--ob-text-primary);
  margin-bottom: 0.5rem;
}

.ob-form-label.required::after {
  content: '*';
  color: var(--ob-danger);
  margin-left: 4px;
  font-weight: 700;
}

.dark-theme .ob-form-label {
  color: var(--ob-dark-text);
}

.ob-form-control {
  border: 2px solid var(--ob-border-color);
  border-radius: var(--ob-radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background-color: #ffffff;
  color: var(--ob-text-primary);
}

.ob-form-control:focus {
  border-color: var(--ob-primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
  outline: none;
}

.ob-form-control:hover:not(:focus) {
  border-color: var(--ob-primary-light);
}

.dark-theme .ob-form-control {
  background: var(--ob-dark-bg);
  border-color: var(--ob-dark-border);
  color: var(--ob-dark-text);
}

.dark-theme .ob-form-control:focus {
  border-color: var(--ob-primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.ob-form-help {
  font-size: 0.875rem;
  color: var(--ob-text-muted);
  margin-top: 0.5rem;
}

.dark-theme .ob-form-help {
  color: var(--ob-dark-text-muted);
}

/* ==========================================
   Кнопки
   ========================================== */

.ob-btn {
  border-radius: var(--ob-radius-md);
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.ob-btn-primary {
  background: linear-gradient(135deg, var(--ob-primary), var(--ob-primary-light));
  border: none;
  color: white;
  box-shadow: var(--ob-shadow-md);
}

.ob-btn-primary:hover {
  background: linear-gradient(135deg, var(--ob-primary-dark), var(--ob-primary));
  transform: translateY(-1px);
  box-shadow: var(--ob-shadow-lg);
  color: white;
}

.ob-btn-success {
  background: linear-gradient(135deg, var(--ob-success), var(--ob-success-light));
  border: none;
  color: white;
  box-shadow: var(--ob-shadow-md);
}

.ob-btn-success:hover {
  background: linear-gradient(135deg, #047857, var(--ob-success));
  transform: translateY(-1px);
  box-shadow: var(--ob-shadow-lg);
  color: white;
}

.ob-btn-warning {
  background: linear-gradient(135deg, var(--ob-warning), var(--ob-warning-light));
  border: none;
  color: white;
  box-shadow: var(--ob-shadow-md);
}

.ob-btn-warning:hover {
  background: linear-gradient(135deg, #b45309, var(--ob-warning));
  transform: translateY(-1px);
  box-shadow: var(--ob-shadow-lg);
  color: white;
}

.ob-btn-outline {
  background: transparent;
  border: 2px solid var(--ob-primary);
  color: var(--ob-primary);
}

.ob-btn-outline:hover {
  background: var(--ob-primary);
  color: white;
  transform: translateY(-1px);
}

.dark-theme .ob-btn-outline {
  border-color: var(--ob-primary-light);
  color: var(--ob-primary-light);
}

/* ==========================================
   Алерты
   ========================================== */

.ob-alert {
  border-radius: var(--ob-radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  border: 1px solid transparent;
}

.ob-alert::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--ob-radius-lg) 0 0 var(--ob-radius-lg);
}

.ob-alert-info {
  background: rgba(8, 145, 178, 0.1);
  border-color: rgba(8, 145, 178, 0.3);
  color: #0e7490;
}

.ob-alert-info::before {
  background: var(--ob-info);
}

.ob-alert-success {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.3);
  color: #047857;
}

.ob-alert-success::before {
  background: var(--ob-success);
}

.ob-alert-warning {
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.3);
  color: #b45309;
}

.ob-alert-warning::before {
  background: var(--ob-warning);
}

.ob-alert-danger {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
  color: #b91c1c;
}

.ob-alert-danger::before {
  background: var(--ob-danger);
}

.dark-theme .ob-alert {
  color: var(--ob-dark-text);
}

/* ==========================================
   Дисклеймер
   ========================================== */

.ob-disclaimer {
  background: linear-gradient(135deg, #fef3cd 0%, #fde68a 100%);
  border: 1px solid var(--ob-warning-light);
  border-left: 4px solid var(--ob-warning);
  border-radius: var(--ob-radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.dark-theme .ob-disclaimer {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.1) 100%);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fde68a;
}

.ob-disclaimer-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================
   Код и Pre
   ========================================== */

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: var(--ob-bg-light);
  border: 1px solid var(--ob-border-color);
  border-radius: var(--ob-radius-sm);
  padding: 0.125rem 0.375rem;
  font-size: 0.875rem;
}

pre {
  background: var(--ob-bg-light);
  border: 1px solid var(--ob-border-color);
  border-radius: var(--ob-radius-md);
  padding: 1rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

.dark-theme code,
.dark-theme pre {
  background: var(--ob-dark-bg);
  border-color: var(--ob-dark-border);
  color: var(--ob-dark-text);
}

/* ==========================================
   Таблицы
   ========================================== */

.ob-table {
  width: 100%;
  border-collapse: collapse;
}

.ob-table th,
.ob-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ob-border-color);
  text-align: left;
}

.ob-table th {
  font-weight: 600;
  background: var(--ob-bg-light);
  color: var(--ob-text-primary);
}

.ob-table tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

.dark-theme .ob-table th,
.dark-theme .ob-table td {
  border-color: var(--ob-dark-border);
}

.dark-theme .ob-table th {
  background: rgba(59, 130, 246, 0.1);
  color: var(--ob-dark-text);
}

.dark-theme .ob-table tr:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* ==========================================
   Бейджи и статусы
   ========================================== */

.ob-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
}

.ob-badge-primary {
  background: rgba(59, 130, 246, 0.15);
  color: var(--ob-primary);
}

.ob-badge-success {
  background: rgba(5, 150, 105, 0.15);
  color: var(--ob-success);
}

.ob-badge-warning {
  background: rgba(217, 119, 6, 0.15);
  color: var(--ob-warning);
}

.ob-badge-danger {
  background: rgba(220, 38, 38, 0.15);
  color: var(--ob-danger);
}

/* ==========================================
   Футер
   ========================================== */

.ob-footer {
  background: var(--ob-card-bg);
  border-top: 1px solid var(--ob-border-color);
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
  color: var(--ob-text-secondary);
  font-size: 0.875rem;
}

.dark-theme .ob-footer {
  background: var(--ob-dark-card);
  border-color: var(--ob-dark-border);
  color: var(--ob-dark-text-muted);
}

.ob-footer a {
  color: var(--ob-primary);
  text-decoration: none;
}

.ob-footer a:hover {
  text-decoration: underline;
}

/* ==========================================
   Экран авторизации
   ========================================== */

.ob-auth-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--ob-bg-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.ob-auth-card {
  background: var(--ob-card-bg);
  border-radius: var(--ob-radius-xl);
  box-shadow: var(--ob-shadow-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.ob-auth-logo {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.ob-auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--ob-text-primary);
}

.ob-auth-subtitle {
  color: var(--ob-text-secondary);
  margin-bottom: 2rem;
}

.ob-auth-error {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: var(--ob-danger);
  padding: 0.75rem;
  border-radius: var(--ob-radius-md);
  margin-bottom: 1rem;
  display: none;
}

.ob-auth-error.show {
  display: block;
}

/* ==========================================
   Утилиты
   ========================================== */

.ob-hidden {
  display: none !important;
}

.ob-text-center {
  text-align: center;
}

.ob-text-muted {
  color: var(--ob-text-muted);
}

.ob-mt-1 { margin-top: 0.25rem; }
.ob-mt-2 { margin-top: 0.5rem; }
.ob-mt-3 { margin-top: 1rem; }
.ob-mt-4 { margin-top: 1.5rem; }

.ob-mb-1 { margin-bottom: 0.25rem; }
.ob-mb-2 { margin-bottom: 0.5rem; }
.ob-mb-3 { margin-bottom: 1rem; }
.ob-mb-4 { margin-bottom: 1.5rem; }

/* ==========================================
   Анимации
   ========================================== */

@keyframes ob-fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ob-animate-in {
  animation: ob-fadeIn 0.4s ease-out;
}
