/**
 * MAIN STYLESHEET
 * 
 * This file styles all the frontend components:
 * - Navigation bar
 * - Canvas grid
 * - Modals/popups
 * - Buttons and forms
 * - Responsive design
 */

/* ========== RESET & GLOBAL STYLES ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 0;
  color: #333;
}

/* ========== NAVBAR ========== */
.navbar {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid #667eea;
}

.navbar-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.logo {
  color: white;
  font-size: 1.8rem;
  margin: 0;
  flex: 1;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-email {
  color: #fff;
  font-size: 0.95rem;
  margin-right: 10px;
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 10px;
  border-radius: 20px;
}

/* ========== BUTTONS ========== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #764ba2;
  color: white;
}

.btn-secondary:hover {
  background: #654190;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(118, 75, 162, 0.4);
}

.btn-success {
  background: #4caf50;
  color: white;
}

.btn-success:hover {
  background: #45a049;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn-danger {
  background: #f44336;
  color: white;
}

.btn-danger:hover {
  background: #da190b;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(244, 67, 54, 0.4);
}

/* ========== CONTAINER & LAYOUT ========== */
.container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 20px;
}

.instructions {
  background: rgba(255, 255, 255, 0.95);
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 2rem;
  text-align: center;
  font-size: 1.1rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* ========== CANVAS GRID ========== */
.canvas-container {
  position: relative;
  display: block;  /* Changed from inline-block (which looked GREAT, gave an off-center (to the left) look) but trying out CENTERED LOOK for now; but feel free changing it back wheneves -Salem -9:19pm on 4/22/26  */
  margin: 2rem auto;
  width: 100%;
  max-width: 1000px;
  height: auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}


#pixelCanvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  cursor: crosshair;
}

/* Hover info tooltip */
.hover-info {
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 0.9rem;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
}

/* ========== MODALS ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 15px;
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2rem;
  cursor: pointer;
  color: #999;
}

.close:hover {
  color: #000;
}

.modal h2 {
  margin-bottom: 1.5rem;
  color: #333;
}

.modal h3 {
  margin: 1.5rem 0 1rem 0;
  color: #667eea;
}

/* ========== PIXEL INFO ========== */
.pixel-info {
  background: #f5f5f5;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.pixel-info p {
  margin: 0.8rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ========== FORMS ========== */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

input[type="email"],
input[type="password"],
input[type="color"],
input[type="text"] {
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="color"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

input[type="color"] {
  width: 100%;
  height: 50px;
  cursor: pointer;
}

/* ========== DASHBOARD ========== */
.dashboard {
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 15px;
  margin: 3rem 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.dashboard h2 {
  margin-bottom: 2rem;
  color: #333;
}

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

.pixel-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1.5rem;
  border-radius: 10px;
  color: white;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.pixel-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.pixel-card-color {
  width: 100%;
  height: 100px;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.pixel-card-coords {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.pixel-card-info {
  font-size: 0.9rem;
  opacity: 0.9;
  margin: 0.3rem 0;
}

/* ========== LOADING SPINNER ========== */
.loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  z-index: 300;
}

.loading p {
  color: white;
  margin-top: 1rem;
  font-size: 1.1rem;
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========== UTILITY CLASSES ========== */
.text-center {
  text-align: center;
}

.text-danger {
  color: #f44336;
}

.text-success {
  color: #4caf50;
}

.text-warning {
  color: #ff9800;
}

/* ========== SECTION STYLING ========== */
#colorChangeSection {
  background: #e8f5e9;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

#colorChangeSection p {
  color: #2e7d32;
  margin-bottom: 1rem;
}

/* ========== RESPONSIVE DESIGN ========== */
/* Tablet screens */
@media (max-width: 768px) {
  .navbar-content {
    flex-direction: column;
    gap: 1rem;
  }

  .logo {
    font-size: 1.4rem;
  }

  .nav-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .modal-content {
    max-width: 90%;
    padding: 1.5rem;
  }

  .pixels-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  #pixelCanvas {
    max-width: 100%;
    height: auto;
  }
}

/* Mobile screens */
@media (max-width: 480px) {
  .instructions {
    font-size: 0.95rem;
    padding: 1rem;
  }

  .btn {
    padding: 8px 15px;
    font-size: 0.9rem;
  }

  .modal-content {
    max-width: 95%;
    padding: 1rem;
  }

  .pixels-grid {
    grid-template-columns: 1fr;
  }

  .logo {
    font-size: 1.2rem;
  }
}

/* ========== ACCESSIBILITY ========== */
/* High contrast mode support */
@media (prefers-contrast: more) {
  .btn {
    border: 2px solid currentColor;
  }

  .pixel-card {
    border: 2px solid white;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ===== PIXEL MODAL STYLING ===== */

.pixel-modal {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px !important;
  max-width: 500px !important;
}

.pixel-modal h2 {
  color: white !important;
  margin-bottom: 25px !important;
  font-size: 28px !important;
  text-align: center !important;
}

.pixel-modal .close {
  color: white !important;
  opacity: 0.8;
}

.pixel-modal .close:hover {
  opacity: 1;
}

/* Info rows styling */
.pixel-info {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}

.info-value {
  font-size: 16px;
  color: white;
  font-weight: 500;
}

.info-value.price {
  font-size: 20px;
  font-weight: bold;
  color: #4ade80;
}

.color-swatch {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Action sections */
.action-section {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 15px;
  backdrop-filter: blur(10px);
}

.action-section h3 {
  color: white !important;
  margin-bottom: 12px !important;
  font-size: 18px !important;
}

.action-section p {
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 15px 0;
  line-height: 1.5;
}

/* Color picker container */
.color-picker-container {
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-picker-container input[type="color"] {
  width: 50px;
  height: 50px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  cursor: pointer;
}

/* Login section */
.login-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  text-align: center;
}

.login-text {
  font-size: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #ffeb3b !important;  /* Changed to bright yellow - matches the gradient better */
  font-weight: 600;
  width: 100%;
}


.modal-auth-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.modal-auth-buttons .btn {
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}



/* Max purchases warning */
.max-purchases {
  background: rgba(255, 152, 0, 0.2) !important;
  border-left: 4px solid #ff9800;
}

.max-purchases p {
  color: #ffeb3b !important;
  margin: 0 !important;
}

/* Large button styling */
.btn-large {
  width: 100%;
  padding: 14px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
}

.changes-available {
  color: rgba(255, 255, 255, 0.8) !important;
  font-size: 14px !important;
  font-style: italic !important;
  margin: 0 !important;
}
