/* General Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, sans-serif;
}

body {
  background: #f4f4f9;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}



/* Header Bar */
.header-bar {
  width: 100%;
  height: 120px;
  background-color: #fff;
  color: #333;
  font-size: 2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  padding-left: 40px;
  border-bottom: 1px solid #ddd;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

/* Back link styling */
.back-link {
  margin-bottom: 20px;
}

.back-link a {
  color: #4A90E2;
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link a:hover {
  text-decoration: underline;
}

/* Login/Signup Container */
.login-container {
  margin-top: 200px;
  background: #fff;
  padding: 40px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.login-container h2 {
  margin-bottom: 5px;
  text-align: center;
  font-size: 1.3rem;
  line-height: 1.4rem;
}

.subtitle {
  text-align: center;
  margin-bottom: 20px;
  color: #777;
  font-size: 0.95rem;
}

label {
  display: block;
  margin-top: 15px;
  font-size: 0.9rem;
  color: #333;
}

input {
  width: 100%;
  padding: 12px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

button {
  width: 100%;
  padding: 12px;
  margin-top: 15px;
  background: #4A90E2;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

button:hover {
  background: #357ABD;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Main Container */
.main-container {
  margin-top: 140px;
  margin-left: auto;
  margin-right: auto;
  width: 80%; /* Fixed width instead of fit-content */
  max-width: 900px;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: all 0.3s ease;
}

/* Projects Section */
.dashboard-header {
  margin-bottom: 20px;
  color: #333;
  font-size: 1.8rem;
  font-weight: 600;
}

/* Ensure planner view has proper spacing */
#plannerView {
  width: 100%;
  min-height: 200px;
}

/* Client project cards styling */
#clientView .project-card {
  width: 220px;
  height: 200px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 15px;
  flex-shrink: 0;
  text-align: center;
}

#clientView .project-card h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 1.1rem;
  font-weight: 600;
}

#clientView .project-card p {
  margin: 0 0 15px 0;
  color: #666;
  font-size: 0.9rem;
}

#clientView .project-card button {
  background: #4A90E2;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
  width: 100%;
  margin: 0;
}

#clientView .project-card button:hover {
  background: #357ABD;
}

.projects-container {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  overflow-x: auto;
  padding-bottom: 20px;
}

.project-card, .add-project-card {
  width: 220px;
  height: 300px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 15px;
  flex-shrink: 0;
}

.project-card input {
  font-weight: bold;
  border: none;
  font-size: 1rem;
  margin-bottom: 10px;
  width: 100%;
}

.project-card input:focus {
  outline: 1px solid #ccc;
}

.clients-label {
  background: #f5f5f5;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clients-label div {
  word-break: break-word;
  white-space: normal; /* allow wrapping */
  font-size: 0.8rem;
  line-height: 1.2rem;
}

.button-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.button-row button {
  flex: 1;
  padding: 6px;
  font-size: 0.9rem;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid #ccc;
  background-color: #4e4e4e;
  transition: background-color 0.2s ease;
}

.button-row button:hover {
  background-color: #ddd;
}

.add-project-card {
  text-align: center;
  cursor: pointer;
  font-size: 1rem;
  color: #333;
}

.plus-circle {
  margin-top: 15px;
  width: 60px;
  height: 60px;
  background: white;
  color: #4A90E2;
  border-radius: 50%;
  border: 2px solid #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  margin-left: auto;
  margin-right: auto;
}

/* Modal Styling */
.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: 2000;
}

.modal-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  min-width: 320px;
  max-width: 400px;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  font-size: 16px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  padding: 4px 8px;
  width: 28px;
  height: 28px;
  margin: 0;
  line-height: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  color: #333;
  background: #e0e0e0;
  border-color: #ccc;
}

.clients-list-entry {
  display: flex;
  justify-content: space-between;
  margin: 5px 0;
  align-items: center;
}

.clients-list-entry select {
  width: 100px;
  flex-shrink: 0;
}

.email-text {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Adjust add-client-row layout specifically */
.add-client-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.add-client-row input {
  flex: 3; /* Take up more space */
}

.add-client-row button {
  flex: 1;          /* Smaller button */
  width: auto;      /* Override global button width */
  padding: 10px 12px;
  margin-top: 0;    /* Align with input */
  background-color: #4A90E2;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.add-client-row button:hover {
  background-color: #357ABD;
}

/* Buttons */
button {
  width: 100%;
  padding: 14px;
  background-color: #4A90E2;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  margin-top: 20px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

button:hover {
  background-color: #357ABD;
}

/* Auth links */
.password-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.forgot-link {
  font-size: 0.8rem;
  text-decoration: none;
  color: #4A90E2;
}

.back-link {
  margin-bottom: 10px;
  font-size: 0.85rem;
}

.back-link a {
  text-decoration: none;
  color: #4A90E2;
}

.back-link a:hover {
  text-decoration: underline;
}

.signup-text {
  text-align: center;
  margin-top: 15px;
  font-size: 0.9rem;
}

.signup-text a {
  color: #4A90E2;
  text-decoration: none;
}

.message {
  text-align: center;
  margin-top: 10px;
  font-size: 0.9rem;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.message.error {
  color: #d32f2f;
  background-color: #ffebee;
  border-color: #ffcdd2;
}

.message.success {
  color: #388e3c;
  background-color: #e8f5e8;
  border-color: #c8e6c9;
}

.message.info {
  color: #1976d2;
  background-color: #e3f2fd;
  border-color: #bbdefb;
}

/* Dropdown menu */
.header-right {
  margin-left: auto;
  padding-right: 40px;
  cursor: pointer;
  position: relative;
  font-size: 0.95rem;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #fff;
  border: 1px solid #ddd;
  box-shadow: 0 5px 10px rgba(0,0,0,0.1);
  border-radius: 6px;
  min-width: 140px;
  z-index: 1000;
}

.dropdown-menu a {
  display: block;
  padding: 10px;
  text-decoration: none;
  color: #333;
  font-size: 0.9rem;
}

.dropdown-menu a:hover {
  background-color: #f0f0f0;
}

/* Utility */
.hidden {
  display: none;
}

/* Unity View Styles - Unity handles its own styling internally */

/* Unity View Container */
#unityView {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

/* When Unity view is hidden, don't take up space */
#unityView.hidden {
  display: none;
}

/* Unity Header */
.unity-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 10px;
}

/* Hide Unity header when Unity view is not active */
#unityView.hidden .unity-header {
  display: none;
}

.back-button {
  background: #4A90E2;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
  width: auto;
  margin: 0;
}

.back-button:hover {
  background: #357ABD;
}

.project-title {
  color: #333;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
}

/* Unity Container - Responsive with aspect ratio preservation */
#unity-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 0;
}

/* When Unity view is hidden, container should not affect layout */
#unityView.hidden #unity-container {
  display: none;
}



/* Unity Canvas - Maintain aspect ratio and fit within container */
#unity-canvas {
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
  max-height: calc(100vh - 200px); /* Account for header and padding */
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  opacity: 0; /* Start hidden, will be shown when Unity loads */
  transition: opacity 0.3s ease;
}

#unity-canvas.loaded {
  opacity: 1;
}

/* Unity Loading Elements */
#unity-loading-bar {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
  display: none; /* Hidden by default */
}

#unity-logo {
  margin: 0 auto 20px;
}

#unity-progress-bar-empty {
  width: 200px;
  height: 20px;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
  margin: 0 auto;
}

#unity-progress-bar-full {
  height: 100%;
  background: linear-gradient(90deg, #4A90E2, #357ABD);
  border-radius: 10px;
  transition: width 0.3s ease;
}

/* Unity Warning Banner */
#unity-warning {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  max-width: 90%;
  text-align: center;
  display: none; /* Hidden by default */
}

/* Responsive adjustments for Unity view */
@media (max-width: 768px) {
  .main-container {
    width: 90%;
    max-width: 90%;
  }
  
  .main-container.expanded-for-unity {
    width: 95%;
    max-width: 95%;
  }
  
  #unityView {
    padding: 10px;
  }
  
  .unity-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  #unity-canvas {
    max-height: calc(100vh - 200px);
  }
  
  #unity-progress-bar-empty {
    width: 150px;
  }
}

@media (max-width: 480px) {
  .main-container {
    width: 95%;
    max-width: 95%;
  }
  
  .main-container.expanded-for-unity {
    width: 98%;
    max-width: 98%;
    padding: 5px;
  }
  
  #unityView {
    padding: 5px;
  }
}



/* When Unity view is active, expand container */
.main-container.expanded-for-unity {
  max-width: 1200px; /* Fixed max width instead of 95% */
  width: 1200px;
  padding: 10px;
}

/* Hide Unity footer elements as requested */
#unity-footer {
  display: none !important;
}

/* Disabled back button for client mode */
#backToProjectsBtn:disabled {
  background-color: #ccc !important;
  color: #666 !important;
  cursor: not-allowed !important;
  opacity: 0.5 !important;
}

#backToProjectsBtn:disabled:hover {
  background-color: #ccc !important;
  transform: none !important;
}