/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #42a5f5 0%, #1976d2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navbar */
.navbar {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  padding: 1rem 0;
  margin-bottom: 2rem;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: #42a5f5;
}

.nav-menu {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-menu a {
  color: #333;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: background 0.3s;
}

.nav-menu a:hover, .nav-menu a.active {
  background: #f0f0f0;
}

.nav-user {
  color: #666;
  font-size: 0.9rem;
}

.btn-logout {
  background: #ff6b6b !important;
  color: white !important;
}

.btn-logout:hover {
  background: #ff5252 !important;
}

/* Buttons */
.btn {
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s;
}

.btn-primary {
  background: #42a5f5;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
  background: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-success {
  background: #51cf66;
  color: white;
}

.btn-success:hover {
  background: #40c057;
}

.btn-danger {
  background: #ff6b6b;
  color: white;
}

.btn-danger:hover {
  background: #ff5252;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
}

/* Auth Pages */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.auth-box {
  background: white;
  padding: 2.5rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.auth-box h1 {
  text-align: center;
  color: #42a5f5;
  margin-bottom: 0.5rem;
  font-size: 2rem;
}

.auth-box h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #333;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: #555;
}

.form-group input, .form-group select {
  padding: 0.8rem;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  font-size: 1rem;
  transition: border 0.3s;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: #42a5f5;
}

.form-group small {
  color: #999;
  font-size: 0.875rem;
}

.auth-link {
  text-align: center;
  margin-top: 1rem;
  color: #666;
}

.auth-link a {
  color: #42a5f5;
  text-decoration: none;
  font-weight: 600;
}

.auth-link a:hover {
  text-decoration: underline;
}

.alert {
  padding: 1rem;
  border-radius: 5px;
  margin-bottom: 1rem;
}

.alert-error {
  background: #ffe0e0;
  color: #c00;
  border: 1px solid #ffb0b0;
}

.alert-info {
  background: #e3f2fd;
  color: #1976d2;
  border: 1px solid #90caf9;
}

/* Main Content */
.main-content {
  padding: 2rem 0;
}

/* Dashboard */
.welcome-section {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  text-align: center;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.welcome-section h1 {
  color: #42a5f5;
  margin-bottom: 0.5rem;
}

.welcome-section p {
  color: #666;
  font-size: 1.1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.dashboard-card {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}

.dashboard-card:hover {
  transform: translateY(-5px);
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.dashboard-card h3 {
  color: #333;
  margin-bottom: 0.5rem;
}

.dashboard-card p {
  color: #666;
  margin-bottom: 1.5rem;
}

/* Page Header */
.page-header {
  background: white;
  padding: 1.5rem;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.page-header h1 {
  color: #42a5f5;
  margin: 0;
}

/* Empty State */
.empty-state {
  background: white;
  padding: 4rem 2rem;
  border-radius: 10px;
  text-align: center;
  color: #999;
  font-size: 1.2rem;
}

/* Maps Grid */
.maps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.map-card {
  background: white;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.map-card h3 {
  color: #333;
  margin-bottom: 0.5rem;
}

.map-card p {
  color: #666;
  margin-bottom: 0.5rem;
}

.map-date {
  font-size: 0.875rem;
  color: #999;
  margin-bottom: 1rem;
}

.map-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Assets Grid */
.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.asset-card {
  background: white;
  padding: 1rem;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.asset-card img {
  max-width: 100%;
  height: 150px;
  object-fit: contain;
  margin-bottom: 1rem;
  border: 2px solid #f0f0f0;
  border-radius: 5px;
}

.asset-card h3 {
  font-size: 1rem;
  color: #333;
  margin-bottom: 0.5rem;
}

.asset-card p {
  font-size: 0.875rem;
  color: #999;
  margin-bottom: 0.5rem;
}

.asset-walkable {
  margin-bottom: 1rem;
}

.badge-collision {
  background: #ff6b6b;
  color: white;
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-walkable {
  background: #51cf66;
  color: white;
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.checkbox-label span {
  flex: 1;
}

/* Characters */
.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.character-card {
  background: white;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.character-card.default-character {
  border: 3px solid #42a5f5;
}

.character-card h3 {
  color: #333;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-default {
  background: #42a5f5;
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-success {
  background: #28a745;
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.character-sprites {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.sprite-item {
  text-align: center;
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
}

.sprite-item img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  background: white;
}

.sprite-item p {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #666;
}

.character-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.preview-box {
  width: 100%;
  height: 100px;
  border: 2px dashed #e0e0e0;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.5rem;
  background: #f8f9fa;
}

.preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.modal-large {
  max-width: 800px;
}

.hint {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  text-align: center;
}

.character-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.character-select-item {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  border: 3px solid transparent;
}

.character-select-item:hover {
  background: #e7f0ff;
  border-color: #42a5f5;
  transform: translateY(-3px);
}

.character-select-item img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
  margin-bottom: 0.5rem;
}

.character-select-item p {
  margin: 0.5rem 0;
  font-weight: 600;
  color: #333;
}

.text-center {
  text-align: center;
  color: #666;
  padding: 2rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 2rem;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  position: relative;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
}

.close:hover {
  color: #000;
}

.modal-content h2 {
  color: #42a5f5;
  margin-bottom: 1.5rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Backoffice */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-icon {
  font-size: 3rem;
}

.stat-info h3 {
  font-size: 2rem;
  color: #42a5f5;
  margin-bottom: 0.25rem;
}

.stat-info p {
  color: #666;
  margin: 0;
}

.backoffice-section {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.backoffice-section h2 {
  color: #42a5f5;
  margin-bottom: 1.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th, .data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.data-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.data-table tr:hover {
  background: #f8f9fa;
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 15px;
  font-size: 0.875rem;
  font-weight: 600;
}

.badge-admin {
  background: #42a5f5;
  color: white;
}

.badge-member {
  background: #e0e0e0;
  color: #666;
}

/* Guide */
.guide-container {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.guide-container h1 {
  color: #42a5f5;
  text-align: center;
  margin-bottom: 2rem;
}

.guide-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #e0e0e0;
}

.tab-button {
  padding: 1rem 2rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
}

.tab-button:hover {
  color: #42a5f5;
}

.tab-button.active {
  color: #42a5f5;
  border-bottom-color: #42a5f5;
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.guide-section {
  margin-bottom: 2.5rem;
}

.guide-section h2 {
  color: #42a5f5;
  margin-bottom: 1rem;
}

.guide-section h3 {
  color: #333;
  margin: 1.5rem 0 1rem;
}

.guide-section h4 {
  color: #555;
  margin: 1rem 0 0.5rem;
}

.guide-section ul, .guide-section ol {
  margin-left: 2rem;
  line-height: 1.8;
}

.guide-section li {
  margin-bottom: 0.5rem;
}

.guide-section code {
  background: #f0f0f0;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

.guide-note, .guide-tip, .guide-troubleshoot {
  background: #f0f7ff;
  border-left: 4px solid #42a5f5;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 5px;
}

.guide-tip {
  background: #fff7e6;
  border-left-color: #ffa94d;
}

.guide-troubleshoot {
  background: #ffe0e0;
  border-left-color: #ff6b6b;
}

.faq h4 {
  color: #42a5f5;
  margin-top: 1rem;
}

.faq p {
  margin-bottom: 1rem;
  padding-left: 1rem;
}

kbd {
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

/* Footer */
.footer {
  background: rgba(255,255,255,0.1);
  color: white;
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer p {
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .navbar .container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-menu {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .page-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .dashboard-grid, .maps-grid, .assets-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .guide-tabs {
    flex-direction: column;
  }
}

/* Media Permission Modal */
.media-preview-container {
  text-align: center;
  margin: 1.5rem 0;
}

#localPreview {
  width: 320px;
  max-width: 100%;
  height: 240px;
  background: #000;
  border-radius: 10px;
  object-fit: cover;
}

#mediaStatus {
  margin-top: 1rem;
  padding: 0.5rem;
  background: #f0f0f0;
  border-radius: 5px;
  font-size: 14px;
}

.media-options {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1.5rem 0;
}

.media-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 16px;
}

.media-options input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* Player Video Elements */
.player-video {
  position: absolute;
  width: 80px;
  height: 60px;
  border: 2px solid #ff6b6b;
  border-radius: 8px;
  object-fit: cover;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

