/* LAYOUT.CSS - Layout styles */

/* HEADER */
header{
  position:fixed; 
  top:0; 
  left:0;
  right:0;
  z-index:11;
  background:#fff;
  border-bottom:1px solid var(--stroke);
  padding:20px 20px;
  display:flex; align-items:center; gap:16px; justify-content:space-between;
}

.brand{display:flex; align-items:center; gap:10px; font-weight:700}
.brand .dot{width:10px; height:10px; border-radius:50%; background:var(--indigo)}

.tabs{display:flex; gap:8px; position:absolute; left:50%; transform:translateX(calc(-50% + 85px));}
.tab{
  padding:10px 12px;
  border:1px solid var(--stroke);
  border-radius:10px;
  background:#fff;
  cursor:pointer;
  color:#111827;
  font-size:13px;
  font-weight:600;
  transition: all 0.2s;
  position: relative;
  white-space: nowrap;
}
.logout-btn{
  margin-left: auto;
}
.theme-toggle {
  font-size: 16px;
  padding: 8px 10px !important;
  min-width: 40px;
}
.tab.active{background:var(--primary-weak); border-color:var(--indigo); color:var(--indigo);}
.tab:hover{border-color:var(--indigo)}

/* Badge для непрочитанных сообщений на вкладке */
.tab-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-actions{display:flex; gap:8px; align-items:center}
.mass-comment-container{display:flex; gap:8px; align-items:center; margin-left:2px; width:180px; justify-content:flex-start;}
.mass-comment-container .mass-comment-btn{display:flex; align-items:center; justify-content:center; padding:10px 12px; border:1px solid var(--stroke); border-radius:10px; background:#fff; cursor:pointer; transition:all 0.2s;}
.mass-comment-container .mass-comment-btn:hover{border-color:var(--indigo);}
.mass-comment-container .mass-comment-btn.active{background:var(--primary-weak); border-color:var(--indigo);}
.last-update{font-size:11px; color:var(--muted); margin-right:8px}

/* CONTAINER */
.container{max-width:1200px; margin:20px auto 10px; padding:0 16px; margin-left:72px; transition: margin-left 0.3s ease; height:calc(100vh - 90px); overflow:hidden; display:flex; flex-direction:column;}
.container.panel-hidden{margin-left:16px;}
.grid{display:grid; grid-template-columns:1.5fr 1fr; gap:16px; flex:1; min-height:0; max-height:100%; overflow:hidden;}
.row{display:grid; grid-template-columns:repeat(3,1fr); gap:16px}

/* CARD */
.card{
  border:1px solid var(--stroke);
  border-radius:16px;
  background:var(--card);
  padding:16px;
  box-shadow:0 1px 0 rgba(16,24,40,.04);
  display:flex;
  flex-direction:column;
  min-height:0;
  max-height:100%;
  overflow:hidden;
}
.card h3{margin:0 0 12px 0; font-size:16px; flex-shrink:0;}
.card .list{
  flex:1;
  overflow-y:auto !important;
  min-height:0;
  max-height:100%;
}
.card-header{display:flex; justify-content:space-between; align-items:center; margin-bottom:12px}

/* VIEW SECTIONS */
section.view{
  display:none;
  flex:1;
  min-height:0;
  max-height:100%;
  overflow:hidden;
}
section.view:not(.hidden){
  display:flex;
  flex-direction:column;
}

#kanban:not(.hidden){
  display:flex;
  flex-direction:column;
  overflow:hidden;
  max-height:100%;
}

#table:not(.hidden){
  display:flex;
  flex-direction:column;
  overflow:hidden;
  max-height:100%;
}

#table .card{
  flex:1;
  min-height:0;
  max-height:100%;
  overflow:hidden;
}

/* RIGHT COLUMN */
.grid > div:nth-child(2){
  display:flex;
  flex-direction:column;
  min-height:0;
  max-height:100%;
  overflow:hidden;
}

.grid > div:nth-child(2) > .card{
  flex:1;
  min-height:0;
  max-height:100%;
  overflow:hidden;
}

/* LIST */
.list{
  display:flex; 
  flex-direction:column; 
  gap:10px; 
  flex:1; 
  overflow-y:auto !important; 
  overflow-x:hidden;
  padding-right:8px; 
  min-height:0;
  max-height:100%;
}
.list::-webkit-scrollbar{width:6px;}
.list::-webkit-scrollbar-track{background:#f1f1f1; border-radius:10px;}
.list::-webkit-scrollbar-thumb{background:#d1d5db; border-radius:10px;}
.list::-webkit-scrollbar-thumb:hover{background:#9ca3af;}

@media (max-width: 960px){
  .grid{grid-template-columns:1fr}
  .row{grid-template-columns:1fr}
  .admin-panel{width:48px}
  .container{margin-left:68px}
}
@media (max-width: 640px){
  .header-actions{flex-wrap:wrap}
  .admin-panel{transform: translateX(-100%)}
  .admin-toggle{display:flex}
  .container{margin-left:0}
}

/* SEARCH */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}
.search-input {
  padding: 8px 12px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  font-size: 13px;
  width: 180px;
  background: #fff;
  color: #111827;
  transition: all 0.2s;
}
.search-input:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 2px var(--primary-weak);
}
.search-input::placeholder {
  color: #9ca3af;
}
.search-btn {
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.search-btn:hover {
  border-color: var(--indigo);
  background: var(--primary-weak);
}
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 300px;
  max-width: 450px;
  max-height: 400px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  z-index: 100;
}
.search-result-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--stroke);
  cursor: pointer;
  transition: background 0.15s;
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background: var(--primary-weak);
}
.search-result-item .container-num {
  font-weight: 600;
  color: var(--indigo);
}
.search-result-item .order-info {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}
.search-result-item .status-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.search-no-results {
  padding: 16px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
}

/* Dark theme search */
[data-theme="dark"] .search-input {
  background: #1f2937;
  border-color: #374151;
  color: #f3f4f6;
}
[data-theme="dark"] .search-input::placeholder {
  color: #6b7280;
}
[data-theme="dark"] .search-btn {
  background: #1f2937;
  border-color: #374151;
  color: #f3f4f6;
}
[data-theme="dark"] .search-results {
  background: #1f2937;
  border-color: #374151;
}
[data-theme="dark"] .search-result-item {
  border-color: #374151;
}
[data-theme="dark"] .search-result-item:hover {
  background: #374151;
}
