/* --- PORTAL SPECIFIC STYLES --- */

/* Layout Adjustments */
body {
  background-color: #f5f7fa; /* Light grey background for dashboard feel */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Portal Main Container */
.portal-section {
  padding-top: 150px; /* Space for fixed navbar */
  padding-bottom: 80px;
  flex: 1; /* Pushes footer down */
  display: flex;
  align-items: center;
  justify-content: center;
}


/* Authentication Cards (Login/Signup) */
.auth-card {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 500px; /* Login width */
  margin: 0 auto;
  animation: fadeIn 0.5s ease;
}

.auth-card.wide {
  max-width: 800px; /* Wider for Signup */
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header img {
  height: 50px;
  margin-bottom: 15px;
}

.auth-header h2 {
  color: #333;
  font-size: 1.8rem;
  font-weight: 700;
}

/* Form Elements */
.input-group {
  margin-bottom: 20px;
  text-align: left;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
  font-size: 0.9rem;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.input-group input:focus,
.input-group select:focus {
  border-color: #c62828;
  outline: none;
}

/* Buttons */
button[type="submit"] {
  width: 100%;
  padding: 14px;
  background: #c62828;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s;
}

button[type="submit"]:hover {
  background: #b71c1c;
}

.form-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: #666;
}

.form-footer a {
  color: #c62828;
  font-weight: 600;
  text-decoration: none;
}

/* Error Messages */
.error-message {
  color: #d32f2f;
  background: #ffebee;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 0.9rem;
  display: none; /* Hidden by default */
}

.error-message:not(:empty) {
  display: block;
}

/* --- DASHBOARD STYLES --- */
.dashboard-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}
header {
    background-color: #333333 !important; 
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Ensure padding pushes the dashboard down enough */
#dashboard-container {
    padding-top: 180px; /* Increased space specifically for dashboard */
}
.dashboard-header {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.dashboard-header h1 {
  color: #fff;
  font-size: 2rem;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-controls span {
  font-weight: 500;
  color: #fff;
}

.button-danger {
  background: white;
  color: #c62828;
  border: 1px solid #c62828;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
}

.button-danger:hover {
  background: #c62828;
  color: white;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.info-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 10px;
}

.card-header h2 {
  font-size: 1.2rem;
  color: #333;
  margin: 0;
}

.table-responsive {
    width: 100%;
    overflow-x: auto; /* Adds scrollbar if content is too wide */
    -webkit-overflow-scrolling: touch;
    margin-top: 15px;
}

.agent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 600px; /* Force scroll on small screens */
}

.agent-table th, 
.agent-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.agent-table th {
    background-color: #fafafa;
    font-weight: 600;
    color: #444;
}

/* Handle long emails */
.agent-table td:nth-child(2) { /* Assuming email is 2nd column */
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Compact Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.action-buttons button {
    padding: 6px 10px;
    font-size: 0.8rem;
}

.button-secondary {
  background: #f5f5f5;
  color: #333;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
}

.button-primary {
  background: #c62828;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* --- Modal Styles --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-content {
  background-color: #fff;
  padding: 30px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  position: relative;
}
.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #888;
}
.modal-content h2 {
  margin-top: 0;
}
.modal-form .input-group {
  margin-bottom: 15px;
}


/* Utility Classes */
.hidden {
  display: none !important;
}

fieldset {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

legend {
  font-weight: 600;
  color: #c62828;
  padding: 0 10px;
}

/* Loader */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.loader-spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #c62828;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .portal-section {
    padding-top: 100px;
    padding-left: 20px;
    padding-right: 20px;
  }
  .auth-card {
    padding: 25px;
  }
  .dashboard-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  .user-controls {
    flex-direction: column;
    gap: 10px;
  }
}
