/* static/css/style.css */
:root { 
  --bg: #0f172a; 
  --card: #ffffff; 
  --ink: #1e293b; 
  --muted: #64748b; 
  --accent: #3b82f6; 
  --accent-dark: #1d4ed8;
  --accent-light: #60a5fa;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-800: #1e293b;
}

*{box-sizing:border-box;}

body{
  margin:0;
  font-family:system-ui,-apple-system,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',Arial,sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-attachment: fixed;
  color:#1e293b;
  line-height:1.6;
  min-height: 100vh;
}

/* === УЛУЧШЕННЫЙ TOPBAR === */
.topbar{
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  color:#fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.container{
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
}

.topbar .container{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 12px 24px;
}

.topbar .brand{
  margin:0;
  font-size: 1.5rem;
  font-weight: 700;
}

.topbar .brand a{
  color:#fff;
  text-decoration:none;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar .brand span{
  color:#c7d2fe;
  font-size: 0.9rem;
  font-weight: 400;
}

.topbar .menu{
  display:flex;
  align-items:center;
  gap: 24px;
}

.topbar .menu a{
  color:#c7d2fe;
  text-decoration:none;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  display:flex;
  align-items:center;
  padding: 8px 16px;
  border-radius: 8px;
  position: relative;
  font-weight: 500;
}

.topbar .menu a:hover{
  color:#fff;
  background: rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}

.topbar .menu a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.topbar .menu a:hover::after {
  width: 80%;
}

.linklike{
  background:none;
  border:none;
  color:#c7d2fe;
  cursor:pointer;
  font-size: 0.95rem;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.linklike:hover{
  color:#fff;
  background: rgba(239, 68, 68, 0.1);
}

/* === УЛУЧШЕННЫЙ MAIN CONTAINER === */
main.container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  margin: 30px auto;
  padding: 32px;
  border: 1px solid rgba(255,255,255,0.2);
  animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === ТИПОГРАФИЯ === */
h1,h2,h3,h4,h5,h6{
  margin:0 0 16px 0;
  color:#1e293b;
  line-height:1.3;
  font-weight: 700;
}

h2{
  font-size: 2rem;
  margin: 0 0 24px 0;
  background: linear-gradient(135deg, #1e293b, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === УЛУЧШЕННЫЕ КАРТОЧКИ === */
.card{
  background: #ffffff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid rgba(226, 232, 240, 0.8);
  margin-bottom: 20px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

/* === УЛУЧШЕННЫЕ ФОРМЫ === */
label{
  display:flex;
  flex-direction:column;
  font-size: 0.95rem;
  font-weight: 600;
  color:#374151;
  margin-bottom: 12px;
}

input,select,textarea{
  margin-top: 8px;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background:#fff;
  font-size: 1rem;
  transition: all 0.3s ease;
  font-family: inherit;
}

input:focus,select:focus,textarea:focus{
  outline:none;
  border-color:#3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

/* === УЛУЧШЕННЫЕ КНОПКИ === */
.actions{
  margin-top: 24px;
  display:flex;
  gap: 16px;
  align-items:center;
  flex-wrap:wrap;
}

button{
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: none;
  color: #fff;
  padding: 14px 28px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover{
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

button:active{
  transform: translateY(-1px);
}

button.danger{
  background: linear-gradient(135deg, var(--danger), #b91c1c);
}

button.danger:hover{
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

.button{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color:#fff;
  padding: 14px 28px;
  border-radius: 12px;
  text-decoration:none;
  font-size: 1rem;
  font-weight:600;
  transition: all 0.3s ease;
  border:none;
  cursor:pointer;
  position: relative;
  overflow: hidden;
}

.button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.button:hover::before {
  left: 100%;
}

.button:hover{
  color:#fff;
  text-decoration:none;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

/* === УЛУЧШЕННАЯ ТАБЛИЦА === */
.table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  border-radius: 16px;
  overflow:hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.table th{
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  padding: 18px 20px;
  text-align:left;
  font-weight: 700;
  font-size: 0.95rem;
  color:#374151;
  border-bottom: 2px solid #e2e8f0;
}

.table td{
  padding: 18px 20px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align:middle;
  font-size: 0.95rem;
  transition: background-color 0.3s ease;
}

.table tr:last-child td{
  border-bottom:none;
}

.table tr:hover td{
  background:#f8fafc;
}

/* === УЛУЧШЕННЫЕ БЕЙДЖИ === */
.unread-badge{
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color:white;
  border-radius: 50px;
  padding: 4px 10px;
  font-size: 0.8rem;
  margin-left: 8px;
  min-width: 22px;
  text-align:center;
  line-height:1;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3); }
  50% { transform: scale(1.1); box-shadow: 0 4px 15px rgba(239, 68, 68, 0.5); }
  100% { transform: scale(1); box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3); }
}

/* === УВЕДОМЛЕНИЯ === */
.notification {
  position: fixed;
  top: 100px;
  right: 30px;
  background: white;
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  z-index: 1000;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid var(--success);
  max-width: 400px;
}

.notification-danger {
  border-left-color: var(--danger);
}

.notification-warning {
  border-left-color: var(--warning);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notification-content {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: between;
  gap: 12px;
}

.notification-content button {
  background: none;
  border: none;
  color: var(--muted);
  padding: 4px;
  font-size: 1.2rem;
  margin: 0;
}

.notification-content button:hover {
  background: none;
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 1200px){
  .container{
    max-width:100%;
    padding: 16px 20px;
  }
}

@media (max-width: 768px){
  .container{
    padding: 12px;
  }
  
  .topbar .container{
    flex-direction:column;
    gap: 16px;
    padding: 16px;
  }
  
  .topbar .menu{
    gap: 12px;
    flex-wrap:wrap;
    justify-content:center;
  }
  
  .grid{
    grid-template-columns:1fr;
    gap: 20px;
  }
  
  .actions{
    flex-direction:column;
    align-items:stretch;
  }
  
  button, .button{
    width:100%;
    justify-content:center;
  }
  
  main.container {
    margin: 20px 12px;
    padding: 24px 20px;
    border-radius: 16px;
  }
}

@media (max-width: 480px){
  .table{
    font-size:0.9rem;
  }
  
  .table th, .table td{
    padding: 12px 14px;
  }
  
  .card{
    padding: 20px;
  }
  
  h2{
    font-size: 1.75rem;
  }
}

/* === АНИМАЦИИ ДЛЯ КАРТОЧЕК ТОВАРОВ === */
.product-preview {
  transition: all 0.3s ease;
  border-radius: 16px;
  overflow: hidden;
}

.product-preview:hover {
  box-shadow: 0 15px 35px rgba(0,0,0,0.15);
  transform: translateY(-8px);
}

.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === FOOTER === */
footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}


/* === СТИЛИ ДЛЯ ЧАТА === */
.chat-wrap {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  height: calc(100vh - 180px);
  background: var(--gray-50);
  border-radius: 16px;
  overflow: hidden;
}

.chat-sidebar {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-thread {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  padding: 20px;
  border-bottom: 1px solid var(--gray-200);
}

.chat-header h3 {
  margin: 0;
  color: white;
  background: none;
  -webkit-text-fill-color: white;
}

.chat-messages {
  padding: 20px;
  overflow: auto;
  flex: 1;
  background: var(--gray-50);
}

.msg {
  margin: 16px 0;
  max-width: 70%;
  animation: fadeIn 0.3s ease;
}

.msg.me {
  margin-left: auto;
  text-align: right;
}

.msg .bubble {
  display: inline-block;
  background: white;
  border-radius: 18px;
  padding: 12px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid var(--gray-200);
  position: relative;
  max-width: 100%;
}

.msg.me .bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  border: none;
}

.msg .bubble::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid white;
}

.msg.me .bubble::before {
  left: auto;
  right: 20px;
  border-top: 8px solid var(--accent);
}

.msg-time {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}

.msg.me .msg-time {
  color: rgba(255,255,255,0.8);
}

.chat-input {
  border-top: 1px solid var(--gray-200);
  padding: 20px;
  background: white;
}

.chat-input textarea {
  width: 100%;
  height: 80px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  font-size: 1rem;
  resize: vertical;
  transition: all 0.3s ease;
}

.chat-input textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Список диалогов */
.list-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--gray-100);
  text-decoration: none;
  color: var(--ink);
  transition: all 0.3s ease;
  position: relative;
}

.list-item:hover {
  background: var(--gray-50);
  transform: translateX(4px);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item.active {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
}

.list-item .title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.list-item .preview {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.list-item .time {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: auto;
}

/* Карточка товара в чате */
.product-preview {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  margin: 8px 0;
  transition: all 0.3s ease;
  cursor: pointer;
}

.product-preview:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.chat-messages .msg.me .product-preview {
  background: rgba(59, 130, 246, 0.05);
  border-color: var(--accent-light);
}

.chat-messages .msg:not(.me) .product-preview {
  background: white;
  border-color: var(--gray-200);
}

.product-preview h4 {
  margin: 0 0 8px 0;
  font-size: 1rem;
  background: none;
  -webkit-text-fill-color: var(--ink);
  color: var(--ink);
}

.product-preview .price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin: 8px 0;
}

.product-preview .details {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Поиск в чате */
.chat-search {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
  background: white;
}

.chat-search input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--gray-300);
  border-radius: 25px;
  font-size: 0.9rem;
}

/* Адаптивность чата */
@media (max-width: 1200px) {
  .chat-wrap {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .chat-sidebar {
    height: 300px;
  }
  
  .chat-thread {
    height: 500px;
  }
}

@media (max-width: 768px) {
  .chat-wrap {
    gap: 16px;
  }
  
  .chat-messages {
    padding: 16px;
  }
  
  .msg {
    max-width: 85%;
  }
  
  .chat-input {
    padding: 16px;
  }
  
  .list-item {
    padding: 12px;
  }
}

/* Анимации */
@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg {
  animation: messageSlide 0.3s ease;
}

/* Добавьте в конец style.css */

/* Стили для улучшенного поиска */
.search-section {
    margin-bottom: 30px;
}

.search-section h2 {
    margin-bottom: 20px;
    color: var(--ink);
    font-size: 1.5rem;
}

.search-main {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.search-wide {
    flex: 1;
}

.large-input {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    border: 2px solid var(--gray-300);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.large-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.search-button {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.search-filters {
    border-top: 1px solid var(--gray-200);
    padding-top: 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.filter-grid label {
    margin-bottom: 0;
}

.filter-grid label span {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.filter-grid input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.95rem;
}

.filter-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.filter-button {
    background: var(--success);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-button:hover {
    background: #0da271;
    transform: translateY(-1px);
}

.clear-button {
    color: var(--muted);
    text-decoration: none;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.clear-button:hover {
    color: var(--danger);
    border-color: var(--danger);
    text-decoration: none;
}

/* Адаптивность для поиска */
@media (max-width: 768px) {
    .search-main {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-button {
        width: 100%;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        justify-content: stretch;
    }
    
    .filter-button,
    .clear-button {
        flex: 1;
        text-align: center;
    }
}

/* Стили для результатов поиска */
.search-results-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-count {
    color: var(--muted);
    font-size: 0.95rem;
}

.search-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.search-tag {
    background: var(--gray-100);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-tag .remove {
    color: var(--danger);
    cursor: pointer;
    font-weight: bold;
}
/* стили для бейджей */
.unread-badge {
    background: #ef4444;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    margin-left: 5px;
}