/* Page Layout */
.page {
  padding: var(--space-md);
  max-width: 800px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease-out;
}

.page-header {
  margin-bottom: var(--space-lg);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Modern Cards */
.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: 0 2px 8px var(--shadow);
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-lg);
}

.card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px var(--shadow);
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 480px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
}

/* Document Card */
.document-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.document-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-primary);
  transform: scaleY(0);
  transition: transform 0.2s;
}

.document-card:hover::before {
  transform: scaleY(1);
}

.document-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px var(--shadow-lg);
}

.document-card:active {
  transform: translateX(2px) scale(0.98);
}

.document-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.document-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.document-meta {
  display: flex;
  gap: var(--space-md);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  align-items: center;
}

.document-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Search Box */
.search-box {
  width: 100%;
  padding: var(--space-md);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: var(--text-base);
  margin-bottom: var(--space-lg);
  transition: all 0.2s;
  font-family: inherit;
}

.search-box:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 4px rgba(0, 136, 204, 0.1);
}

.search-box::placeholder {
  color: var(--text-tertiary);
}

/* Document Content */
.document-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  line-height: 1.8;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow-sm);
}

/* Buttons */
.button {
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: white;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px var(--shadow);
  position: relative;
  overflow: hidden;
}

.button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.button:active::before {
  width: 300px;
  height: 300px;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-lg);
}

.button:active {
  transform: translateY(0) scale(0.95);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Forms */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--border-color, rgba(255,255,255,0.1));
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: inherit;
  transition: all 0.2s;
}

/* Select styling */
select.form-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23707579' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  cursor: pointer;
}

select.form-input option {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: var(--space-sm);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
  opacity: 1;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 4px rgba(0, 136, 204, 0.1);
}

.form-textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.6;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--text-tertiary);
  animation: fadeIn 0.5s ease-out;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state-text {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* Error Message */
.error-message {
  background: linear-gradient(135deg, #F44336 0%, #E53935 100%);
  color: white;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
  animation: slideUp 0.3s ease-out;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.badge-primary {
  background: rgba(0, 136, 204, 0.1);
  color: var(--accent-primary);
}

.badge-success {
  background: rgba(76, 175, 80, 0.1);
  color: var(--success);
}

/* Grid Layout */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Skeleton Loader */
.skeleton-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border: 1px solid var(--border);
}

.skeleton-title {
  height: 24px;
  width: 70%;
  margin-bottom: var(--space-sm);
}

.skeleton-text {
  height: 16px;
  width: 100%;
  margin-bottom: var(--space-xs);
}

.skeleton-text:last-child {
  width: 80%;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors - Light Theme */
  --bg-primary: #F8F9FA;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F0F2F5;
  
  --text-primary: #000000;
  --text-secondary: #65676B;
  --text-tertiary: #8A8D91;
  
  --accent-primary: #0088CC;
  --accent-secondary: #5288C1;
  --accent-hover: #0077B5;
  
  --success: #4CAF50;
  --warning: #FF9800;
  --error: #F44336;
  --info: #2196F3;
  
  --border: rgba(0, 0, 0, 0.08);
  --border-color: rgba(0, 0, 0, 0.15);
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-sm: rgba(0, 0, 0, 0.05);
  --shadow-lg: rgba(0, 0, 0, 0.15);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* Typography */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

.dark {
  --bg-primary: #0E1621;
  --bg-secondary: #17212B;
  --bg-tertiary: #1F2A35;
  
  --text-primary: #FFFFFF;
  --text-secondary: #C4C4C4;  /* Увеличена контрастность с #AAAAAA */
  --text-tertiary: #9A9EA3;   /* Увеличена контрастность с #707579 */
  
  --border-color: rgba(255, 255, 255, 0.15);
  
  --accent-primary: #5288C1;
  --accent-secondary: #4A7BA7;
  --accent-hover: #6B9FD9;
  
  --success: #66BB6A;
  --warning: #FFA726;
  --error: #EF5350;
  --info: #42A5F5;
  
  --border: rgba(255, 255, 255, 0.12);
  --shadow: rgba(0, 0, 0, 0.4);
  --shadow-sm: rgba(0, 0, 0, 0.2);
  --shadow-lg: rgba(0, 0, 0, 0.6);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  font-size: var(--text-base);
  line-height: 1.5;
}

.app {
  min-height: 100vh;
  background: var(--bg-primary);
}

/* Loading Screen */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: var(--space-lg);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-tertiary);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes shimmer {
  0% { background-position: -468px 0; }
  100% { background-position: 468px 0; }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

.slide-up {
  animation: slideUp 0.4s ease-out;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 0px,
    var(--bg-secondary) 40px,
    var(--bg-tertiary) 80px
  );
  background-size: 800px;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-md);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}
