* { box-sizing: border-box; }

:root {
  --bg-primary: #0f1115;
  --bg-secondary: #151922;
  --bg-card: linear-gradient(145deg, #1c2230 0%, #171c26 100%);
  --bg-card-hover: linear-gradient(145deg, #232a3b 0%, #1c2230 100%);
  --text-primary: #eaeaea;
  --text-secondary: #a0a0a0;
  --border-color: rgba(255, 255, 255, 0.05);
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-elevated: rgba(0, 0, 0, 0.5);
  --accent-blue: #4a9eff;
  --accent-green: #4ade80;
  --accent-purple: #a78bfa;
  --gradient-overlay: linear-gradient(135deg, rgba(74, 158, 255, 0.03) 0%, rgba(167, 139, 250, 0.03) 100%);
}

body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-overlay);
  pointer-events: none;
  z-index: 0;
}

header {
  padding: 15px 20px;
  text-align: center;
  background: var(--bg-secondary);
  backdrop-filter: blur(10px);
  font-size: 24px;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 4px 20px var(--shadow), 0 1px 0 var(--border-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.home-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.home-btn:hover {
  background: var(--border-color);
  transform: scale(1.1);
}

.header-title {
  font-size: 20px;
  white-space: nowrap;
  display: none;
}

.header-search {
  flex: 0 1 600px;
  display: flex;
  gap: 10px;
  align-items: center;
  position: relative;
  margin: 0 auto;
  margin-left: 26.3%;
}

#headerSearchInput {
  flex: 1;
  padding: 10px 40px 10px 15px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.3s;
}

#headerSearchInput:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.refresh-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  background: var(--border-color);
  transform: rotate(180deg);
}

.search-settings-btn {
  position: absolute;
  right: 58px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.hamburger-icon {
  width: 16px;
  height: 2px;
  background: rgba(160, 160, 160, 0.5);
  border-radius: 1px;
  transition: background 0.2s;
}

.search-settings-btn:hover .hamburger-icon {
  background: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

.menu-toggle-btn {
  width: 35px;
  height: 35px;
  background: var(--bg-card);
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-toggle-btn:hover {
  background: var(--border-color);
  transform: scale(1.1);
}

.media-btn,
.messages-btn {
  width: 35px;
  height: 35px;
  background: var(--bg-card);
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.media-btn:hover,
.messages-btn:hover {
  background: var(--border-color);
  transform: scale(1.1);
}

.messages-icon {
  width: 35px;
  height: 35px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 18px;
  position: relative;
}

.messages-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--shadow);
}

.messages-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: linear-gradient(135deg, #ff4757 0%, #e84118 100%);
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
  min-width: 18px;
  text-align: center;
}

.sidebar {
  position: fixed;
  top: 70px;
  left: -320px;
  width: 320px;
  height: calc(100vh - 70px);
  background: var(--bg-secondary);
  box-shadow: 4px 0 20px var(--shadow-elevated);
  z-index: 150;
  transition: left 0.3s;
  overflow-y: auto;
}

.sidebar.active {
  left: 0;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
  margin: 0;
  font-size: 18px;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 32px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.sidebar-close:hover {
  background: var(--border-color);
}

.sidebar-nav {
  padding: 20px 10px;
}

.sidebar-item {
  display: block;
  padding: 12px 15px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.2s;
  font-size: 15px;
  margin-bottom: 5px;
}

.sidebar-item:hover {
  background: var(--border-color);
  transform: translateX(-5px);
}

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

.sidebar-item.disabled:hover {
  background: none;
  transform: none;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-color);
  margin: 10px 0;
}

.sidebar-overlay {
  position: fixed;
  top: 70px;
  left: 0;
  width: 100%;
  height: calc(100vh - 70px);
  background: rgba(0, 0, 0, 0.5);
  z-index: 149;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.user-icon {
  width: 42px;
  height: 42px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 22px;
}

.user-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--shadow);
}

.search-container {
  max-width: 600px;
  margin: 30px auto 0;
  padding: 0 30px;
  display: flex;
  gap: 15px;
  align-items: center;
}

#searchInput {
  flex: 1;
  padding: 15px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  transition: all 0.3s;
}

#searchInput:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 30px;
  position: relative;
  z-index: 1;
}

.page-layout {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.left-panel,
.right-panel {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 15px var(--shadow), 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: fit-content;
}

.main-content {
  min-width: 0;
}

.panel-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 15px var(--shadow), 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}

.panel-title {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: var(--text-primary);
}

.panel-content {
  font-size: 14px;
  color: var(--text-secondary);
}

.panel-content p {
  margin: 0;
}

.friends-online {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.friend-online-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  transition: background 0.2s;
  cursor: pointer;
}

.friend-online-item:hover {
  background: var(--border-color);
}

.friend-online-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a3245 0%, #1f2633 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.friend-online-info {
  flex: 1;
  min-width: 0;
}

.friend-online-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.friend-online-status {
  font-size: 12px;
  color: var(--accent-green);
}

.category-section {
  margin-bottom: 50px;
  opacity: 0;
  animation: fadeIn 0.5s forwards;
}

.category-section:nth-child(1) { animation-delay: 0.1s; }
.category-section:nth-child(2) { animation-delay: 0.2s; }
.category-section:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.category-title {
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--text-primary);
  padding-left: 10px;
  border-left: 4px solid var(--accent-blue);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 25px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  box-shadow: 0 4px 15px var(--shadow), 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: visible;
}

.card:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.card-icon {
  font-size: 48px;
  margin-bottom: 10px;
  transition: transform 0.3s;
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px var(--shadow-elevated), 0 8px 16px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--border-color), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  background: var(--bg-card-hover);
}

.card:hover .card-icon {
  transform: scale(1.15);
}

.card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.card.disabled:hover {
  transform: none;
  box-shadow: 0 4px 15px var(--shadow);
}

.card.disabled:hover .card-icon {
  transform: none;
}

.card h2 {
  margin: 10px 0 8px;
  font-size: 18px;
  position: relative;
  z-index: 1;
}

.card-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, var(--accent-blue) 0%, #3a7fd5 100%);
  color: white;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.badge-info {
  background: linear-gradient(135deg, var(--accent-green) 0%, #38b764 100%);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.status-badge {
  display: inline-block;
  margin-top: 10px;
  background: linear-gradient(135deg, var(--accent-purple) 0%, #8b6fd9 100%);
  color: white;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(167, 139, 250, 0.3);
}

.card.hidden {
  display: none;
}

.card.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.card.drag-over {
  border: 2px dashed var(--accent-blue);
  background: var(--bg-card-hover);
}

.reset-layout-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--shadow);
}

.reset-layout-btn:hover {
  background: var(--border-color);
  transform: translateY(-2px) rotate(19deg);
  box-shadow: 0 4px 12px var(--shadow);
}

.context-menu {
  position: fixed;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 12px 32px var(--shadow-elevated), 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  min-width: 220px;
  padding: 8px;
  backdrop-filter: blur(10px);
}

.context-menu-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.context-item {
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.context-item:hover {
  background: var(--border-color);
  transform: translateX(2px);
}

.context-icon {
  font-size: 16px;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.context-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.last-update {
  margin-top: 8px;
  font-size: 11px;
  opacity: 0.7;
}

footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  opacity: 0.5;
  margin-top: 20px;
}

@media (max-width: 1400px) {
  .page-layout {
    grid-template-columns: 1fr 320px;
  }
  
  .left-panel {
    display: none;
  }
}

@media (max-width: 1024px) {
  .page-layout {
    grid-template-columns: 1fr;
  }
  
  .right-panel {
    display: none;
  }
}

@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }
  
  .card {
    padding: 20px 15px;
  }
  
  .card-icon {
    font-size: 36px;
  }
  
  header {
    font-size: 20px;
    padding: 12px 10px;
    gap: 10px;
  }
  
  .home-btn {
    padding: 6px;
    font-size: 20px;
  }
  
  .header-search {
    max-width: none;
  }
  
  .refresh-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .header-actions {
    gap: 8px;
  }
  
  .menu-toggle-btn,
  .media-btn,
  .messages-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  
  .user-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

.notifications-btn {
  width: 35px;
  height: 35px;
  background: var(--bg-card);
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.notifications-btn:hover {
  background: var(--border-color);
  transform: scale(1.1);
}

.post-creation-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 15px var(--shadow), 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  margin-bottom: 30px;
}

.post-creation-header {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 15px;
}

.user-avatar-small {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a3245 0%, #1f2633 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.post-input {
  flex: 1;
  padding: 12px 15px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.3s;
}

.post-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.post-creation-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.post-action-btn {
  padding: 8px 15px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.post-action-btn:hover {
  background: var(--border-color);
}

.post-submit-btn {
  padding: 8px 20px;
  background: var(--accent-blue);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.post-submit-btn:hover {
  background: #3a8eef;
  transform: translateY(-2px);
}

.quick-menu-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.quick-menu-btn:hover {
  background: var(--border-color);
}

.menu-line {
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: background 0.2s;
}

.quick-menu-btn:hover .menu-line {
  background: var(--text-primary);
}
