/* CSS Design System for "Найди котость" */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121e;
  --panel-bg: rgba(20, 20, 35, 0.6);
  --panel-border: rgba(255, 255, 255, 0.06);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --accent: #8b5cf6; /* Violet */
  --accent-glow: rgba(139, 92, 246, 0.4);
  --accent-cyan: #06b6d4;
  --success: #10b981; /* Green */
  --success-glow: rgba(16, 185, 129, 0.3);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  
  /* Difficulty colors */
  --diff-pleasant: #10b981; /* приятность */
  --diff-easy: #06b6d4;     /* лёгкость */
  --diff-normal: #eab308;   /* нормальность */
  --diff-hard: #f97316;     /* тяжелость */
  --diff-expert: #ef4444;   /* сложность */
  --diff-infinite: #ec4899; /* бесконечность */
  
  --font-sans: 'Outfit', 'Roboto', 'Segoe UI', sans-serif;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* App Background with glowing circles */
.app-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: radial-gradient(circle at 10% 20%, rgba(30, 20, 60, 0.6) 0%, rgba(10, 10, 15, 1) 90%);
}

.app-background::before,
.app-background::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  pointer-events: none;
}

.app-background::before {
  top: 20%;
  left: 15%;
  width: 400px;
  height: 400px;
  background: var(--accent);
}

.app-background::after {
  bottom: 20%;
  right: 15%;
  width: 500px;
  height: 500px;
  background: var(--accent-cyan);
}

/* Glassmorphism Panel Template */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Main Layout Container */
.game-container {
  display: flex;
  flex-direction: column;
  width: 95vw;
  max-width: 1300px;
  height: 90vh;
  max-height: 850px;
  gap: 16px;
}

/* Header Area */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: rgba(15, 15, 25, 0.4);
  backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
}

.logo-area h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.accent-text {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-area .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 300;
}

/* Header Controls & Progress Bar */
.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.progress-label {
  font-size: 13px;
  color: var(--text-muted);
}

.progress-bar-wrapper {
  width: 120px;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--accent-cyan));
  border-radius: 4px;
  box-shadow: 0 0 10px var(--success-glow);
  transition: width 0.5s cubic-bezier(0.1, 0.8, 0.25, 1);
}

.progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  min-width: 35px;
}

/* Buttons */
.btn {
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  color: white;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 8px var(--danger-glow);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.icon-button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  transition: all var(--transition-fast);
}

.icon-button:hover {
  color: var(--text-main);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

/* Main Content Workspace Layout */
.game-main {
  display: flex;
  flex: 1;
  gap: 16px;
  height: calc(100% - 75px);
}

/* Sidebar Index (320px width) */
.sidebar-index {
  width: 340px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--panel-border);
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Sidebar filter tabs */
.filter-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin-bottom: 12px;
}

.filter-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 0;
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition-fast);
  text-align: center;
}

.filter-tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Sidebar Search Box */
.search-box input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

/* Scrollbar styles */
.scrollable {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.scrollable::-webkit-scrollbar {
  width: 6px;
}

.scrollable::-webkit-scrollbar-track {
  background: transparent;
}

.scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Cats List in Sidebar */
.cats-list {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Cat Card List Item */
.cat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cat-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.cat-card.active {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.25);
}

.cat-avatar-container {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.cat-avatar-canvas {
  width: 100%;
  height: 100%;
}

/* Gray out silhouette if not found */
.cat-card.not-found .cat-avatar-container {
  filter: brightness(0.2) contrast(0.8);
}

.cat-info {
  flex: 1;
  min-width: 0; /* truncate text properly */
}

.cat-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.cat-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.cat-card.not-found .cat-name {
  color: var(--text-muted);
}

.cat-loc-indicator {
  font-size: 11px;
  color: var(--text-muted);
}

/* Found Status Indicator Checkmark */
.status-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cat-card.found .status-indicator {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.cat-card.not-found .status-indicator {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.15);
}

/* Cat Details Card Slide-in Panel */
.cat-details-card {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  z-index: 10;
  padding: 16px;
  background: rgba(10, 10, 18, 0.95);
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.close-btn:hover {
  color: var(--text-main);
}

.details-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.details-visual {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.details-content h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.details-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 10px;
}

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

.difficulty-tag {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tag Difficulty Specific Colors */
.diff-приятность { background: rgba(16, 185, 129, 0.15); color: var(--diff-pleasant); border: 1px solid rgba(16, 185, 129, 0.3); }
.diff-легкость, .diff-легкая { background: rgba(6, 182, 212, 0.15); color: var(--diff-easy); border: 1px solid rgba(6, 182, 212, 0.3); }
.diff-нормальность { background: rgba(234, 179, 8, 0.15); color: var(--diff-normal); border: 1px solid rgba(234, 179, 8, 0.3); }
.diff-тяжелость { background: rgba(249, 115, 22, 0.15); color: var(--diff-hard); border: 1px solid rgba(249, 115, 22, 0.3); }
.diff-сложность { background: rgba(239, 68, 68, 0.15); color: var(--diff-expert); border: 1px solid rgba(239, 68, 68, 0.3); }
.diff-бесконечность { 
  background: rgba(236, 72, 153, 0.15); 
  color: var(--diff-infinite); 
  border: 1px solid rgba(236, 72, 153, 0.3);
  animation: pulseNeon pink 2s infinite; 
}
.diff-экстремальность {
  background: rgba(217, 70, 239, 0.18);
  color: #f472b6;
  border: 1px solid rgba(217, 70, 239, 0.45);
  box-shadow: 0 0 8px rgba(217, 70, 239, 0.35);
}

.details-desc p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Right Game Viewport Container */
.game-viewport-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Location Selector Navigation Tabs */
.location-tabs {
  display: flex;
  padding: 6px;
  gap: 6px;
}

.loc-tab {
  flex: 1;
  font-family: var(--font-sans);
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-align: center;
  white-space: nowrap;
}

.loc-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.loc-tab.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.25));
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Main canvas wrapper viewport */
.viewport-wrapper {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Canvas setup */
#gameCanvas {
  display: block;
  background-color: #0d0e15;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  cursor: grab;
}

#gameCanvas:active {
  cursor: grabbing;
}

/* Shelter floor switcher overlays */
.floor-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-md);
  z-index: 5;
  background: rgba(10, 10, 15, 0.85);
  border: 1px solid rgba(255,255,255,0.08);
}

.floor-btn {
  font-family: var(--font-sans);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.floor-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.floor-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.4);
}

/* Viewport Instructions Overlay */
.viewport-hints {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 4;
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(4px);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
  color: var(--text-muted);
}

.hint-item b {
  color: var(--text-main);
}

.mouse-icon, .click-icon {
  color: var(--accent-cyan);
}

/* Victory Screen Overlay */
.victory-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 10, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  animation: fadeIn 0.4s ease-out forwards;
}

.victory-card {
  padding: 40px;
  width: 80%;
  max-width: 450px;
  text-align: center;
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 10px 50px rgba(16, 185, 129, 0.2);
  animation: scaleUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.victory-card .stars {
  font-size: 32px;
  margin-bottom: 12px;
  letter-spacing: 6px;
  animation: bounce 2s infinite;
}

.victory-card h2 {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.victory-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Keyframes & Animations */
@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

@keyframes scaleUp {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulseNeon {
  0%, 100% { box-shadow: 0 0 5px rgba(236, 72, 153, 0.3); }
  50% { box-shadow: 0 0 15px rgba(236, 72, 153, 0.6); }
}

/* Administration Room Overlay */
.admin-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85); /* Deep slate backdrop */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}

.admin-card {
  width: 90%;
  max-width: 660px;
  background: rgba(30, 41, 59, 0.95);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.admin-card h2 {
  font-family: var(--font-sans);
  color: var(--text-main);
  font-size: 20px;
  margin-bottom: 16px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.admin-canvas-wrapper {
  background: #0f172a;
  border-radius: var(--radius-sm);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-canvas-wrapper canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  cursor: crosshair;
}

.admin-card .close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.admin-card .close-btn:hover {
  color: #ef4444;
}

.hidden {
  display: none !important;
}

/* Responsive fixes */
@media (max-width: 1024px) {
  .game-container {
    height: 95vh;
  }
  .game-main {
    flex-direction: column-reverse;
    overflow-y: auto;
  }
  .sidebar-index {
    width: 100%;
    height: 300px;
    flex: none;
  }
  .game-viewport-container {
    flex: 1;
    min-height: 500px;
  }
  .viewport-wrapper {
    height: 500px;
  }
  #gameCanvas {
    width: 100%;
    height: auto;
    max-width: 500px;
  }
}
