/* Layout Improvements CSS */

/* Custom animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Apply animations to elements */
h1 {
  animation: fadeIn 0.8s ease-out;
}

.card {
  animation: slideInUp 0.5s ease-out;
  animation-fill-mode: both;
}

/* Stagger card animations */
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }

/* Enhanced container styling */
.game-container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 1.5rem;
  background-color: #2d3748;
  border-radius: 1rem;
  box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  border-top: 5px solid #0066b3; /* Capitec blue border */
  position: relative;
  overflow: hidden;
}

/* Add subtle background pattern */
.game-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 25px 25px, rgba(255, 255, 255, 0.03) 2px, transparent 0),
    radial-gradient(circle at 75px 75px, rgba(255, 255, 255, 0.03) 2px, transparent 0);
  background-size: 100px 100px;
  pointer-events: none;
  z-index: 0;
}

/* Make content appear above the pattern */
.game-container > * {
  position: relative;
  z-index: 1;
}

/* Enhanced card styling */
.card {
  background-color: #4a5568;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-left: 3px solid #0066b3; /* Capitec blue accent */
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-left-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Card hover effects for different card types */
.card:nth-child(3n+1):hover {
  border-left-color: #00b140; /* Capitec green */
}

.card:nth-child(3n+2):hover {
  border-left-color: #f6ad55; /* Orange */
}

.card:nth-child(3n+3):hover {
  border-left-color: #6b46c1; /* Purple */
}

/* Enhanced button styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  gap: 0.5rem;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 50% 50%;
}

.btn:focus:not(:active)::after {
  animation: ripple 0.7s ease-out;
}

/* Enhanced table styling */
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

table th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: #a0aec0;
  padding: 0.75rem 0.5rem;
  border-bottom: 2px solid #4a5568;
}

table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(74, 85, 104, 0.5);
  transition: background-color 0.2s ease;
}

table tr:hover td {
  background-color: rgba(0, 0, 0, 0.1);
}

/* Improved scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #2d3748;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #4a5568;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #0066b3; /* Capitec blue */
}

/* Improved focus styles */
:focus {
  outline: 2px solid rgba(0, 102, 179, 0.5);
  outline-offset: 2px;
}

/* Improved heading styles */
h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.025em;
}

/* Improved badge styling */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #e53e3e;
  color: white;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  height: 1.5rem;
  min-width: 1.5rem;
  padding: 0 0.5rem;
  margin-left: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Improved modal styling */
.modal-content {
  background-color: #2d3748;
  padding: 1.75rem;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  max-width: 700px;
  width: 90%;
  max-height: 90vh;
  overflow-y: hidden;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s ease-in-out;
  display: flex;
  flex-direction: column;
  border-top: 4px solid #0066b3; /* Capitec blue */
}

/* Improved activity log */
#activity-log {
  max-height: 300px;
  overflow-y: auto;
  background-color: #2d3748;
  padding: 0.75rem;
  border-radius: 0.5rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.log-entry {
  font-size: 0.85rem;
  color: #cbd5e0;
  margin-bottom: 0.35rem;
  line-height: 1.5;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  transition: transform 0.2s ease;
}

.log-entry:hover {
  transform: translateX(3px);
}

/* Improved input styling */
.input-number {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid #718096;
  background-color: #1a202c;
  color: #e2e8f0;
  text-align: right;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-number:focus {
  border-color: #0066b3; /* Capitec blue */
  box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.3);
}

/* Improved focus visible styles for accessibility */
*:focus-visible {
  outline: 2px solid #0066b3;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0, 102, 179, 0.3);
}

/* Smooth scrolling for the entire page */
html {
  scroll-behavior: smooth;
}

/* Improved button hover effects */
.btn-primary:hover:not(:disabled) {
  background-color: #0055a4;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Improved table row hover effect */
table tr {
  transition: all 0.2s ease;
}

table tr:hover {
  background-color: rgba(0, 102, 179, 0.1);
}

/* Add subtle hover effect to inputs */
input:hover {
  border-color: #4299e1;
}

/* Improved modal animations */
.modal-overlay.show .modal-content {
  animation: slideInUp 0.3s ease-out;
}

/* Capitec branding elements */
.capitec-logo {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  opacity: 0.7;
  transition: opacity 0.3s ease, transform 0.3s ease;
  width: 100px;
  height: auto;
  z-index: 10;
}

.capitec-logo:hover {
  opacity: 1;
  transform: scale(1.05);
}

/* Responsive improvements */
@media (max-width: 768px) {
  .game-container {
    padding: 1.25rem;
    margin: 1rem;
  }
  
  .card {
    padding: 1rem;
  }
  
  h1 {
    font-size: 1.75rem !important;
  }
  
  .btn {
    padding: 0.5rem 0.75rem;
  }
}

/* Game Controls in Top Right Corner */
.game-controls {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  display: flex;
  gap: 0.75rem;
  z-index: 10;
  background-color: rgba(26, 32, 44, 0.6);
  padding: 0.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Game controls tooltip container */
.game-controls .tooltip-container {
  position: relative;
}

.game-controls .tooltip-text {
  top: -35px;
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 0.35rem 0.5rem;
}

.game-control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #4a5568;
  color: #e2e8f0;
  border: none;
  border-radius: 0.5rem;
  padding: 0.6rem;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.game-control-btn svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Remove old game-control-label styles since we're using tooltips now */
.game-control-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-control-btn:active {
  transform: translateY(1px);
}

/* Style each button differently with more visible colors */
.game-controls .tooltip-container:nth-child(1) .game-control-btn {
  border: 2px solid #00b140;
  background-color: rgba(0, 177, 64, 0.2);
  color: #00b140;
}

.game-controls .tooltip-container:nth-child(2) .game-control-btn {
  background-color: rgba(0, 102, 179, 0.2);
  border: 2px solid #0066b3;
  color: #0066b3;
}

.game-controls .tooltip-container:nth-child(3) .game-control-btn {
  background-color: rgba(237, 137, 54, 0.2);
  border: 2px solid #ed8936;
  color: #ed8936;
}

.game-controls .tooltip-container:nth-child(4) .game-control-btn {
  background-color: rgba(229, 62, 62, 0.2);
  border: 2px solid #e53e3e;
  color: #e53e3e;
}

/* Adjust Capitec logo position to not overlap with game controls */
.capitec-logo {
  top: 1.5rem;
  left: 1.5rem; /* Move logo to the left side */
}

/* Responsive adjustments for game controls */
@media (max-width: 768px) {
  .game-controls {
    position: fixed;
    top: auto;
    bottom: 1rem;
    right: 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  /* Expanded sections after Game section removal */
  .market-section-expanded {
    /* Increase the size and prominence of the marketplace section */
    max-height: none;
    transition: all 0.3s ease;
  }
  
  .market-section-expanded .card {
    max-height: 75vh;
    overflow-y: auto;
  }
  
  .activity-log-expanded {
    /* Make the activity log more prominent */
    margin-bottom: 1.5rem;
  }
  
  .activity-log-expanded #activity-log {
    max-height: 450px; /* Increase the height of the activity log */
  }
  
  /* Adjust the grid layout for better space utilization */
  @media (min-width: 1024px) {
    .market-section-expanded .card {
      min-height: 600px;
    }
  }
  
  .game-control-btn {
    padding: 0.4rem;
  }
  
  .game-control-btn svg {
    width: 1.1rem;
    height: 1.1rem;
  }
  
  .game-control-label {
    top: 50%;
    left: -0.5rem;
    transform: translateY(-50%) translateX(-100%);
  }
  
  .game-control-label::after {
    top: 50%;
    left: 100%;
    margin-left: 0;
    margin-top: -6px;
    border-color: transparent transparent transparent #2d3748;
  }
  
  .game-control-btn:hover .game-control-label {
    transform: translateY(-50%) translateX(-100%) translateX(-5px);
  }
  
  .capitec-logo {
    right: 1rem;
  }
}