/* dashboard.css */
/* Styles for Dashboard Page */

.dashboard-page {
  /* Adjust padding to account for fixed header */
  padding-top: 100px; /* Sufficient space below header */
  padding-bottom: 40px; /* Base padding for the page */
  min-height: 100vh; /* Ensure page takes at least full viewport height */
  position: relative; /* Needed for particle container */
  z-index: 1; /* Ensure dashboard content is above body background */
  background-color: var(--background-color); /* Use base background */
  transition: background-color 0.5s ease; /* Smooth transition */
}

.dashboard-container {
  display: flex;
  flex-direction: row; /* Sidebar and content side-by-side */
  gap: 30px; /* Space between sidebar and content */
  padding-top: 20px; /* Add some space below the header within the container */
}

/* Sidebar Styles */
.sidebar {
  width: 250px; /* Fixed width for sidebar */
  flex-shrink: 0; /* Prevent shrinking */
  background-color: var(--card-background); /* Use card background */
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--card-default-shadow);
  transition: background-color 0.5s ease, border-color 0.5s ease,
    box-shadow 0.3s ease;
  position: sticky; /* Make sidebar sticky */
  top: 120px; /* Position below the header (adjust if header height changes) */
  align-self: flex-start; /* Align to the top */
  max-height: calc(
    100vh - 140px
  ); /* Max height to fit viewport, considering header/footer space */
  overflow-y: auto; /* Add scroll if content exceeds max height */
  z-index: 10; /* Ensure sidebar is above content */
}

/* --- Dashboard Navigation Styles --- */
/* Override horizontal styles from main nav */
.dashboard-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex; /* Keep flex for item alignment */
  flex-direction: column; /* Make it vertical */
  gap: 5px; /* Small gap between list items */
}

.dashboard-nav li {
  margin: 0; /* Remove margin from main nav */
}

.dashboard-nav a {
  display: flex; /* Use flex for icon and text alignment */
  align-items: center;
  padding: 12px 15px; /* Increased padding */
  text-decoration: none;
  color: var(--text-color);
  font-weight: 600;
  border-radius: 8px;
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease; /* Added transform for subtle hover */
  width: 100%; /* Make links fill the list item width */
  box-sizing: border-box; /* Include padding in width */
}

.dashboard-nav a i {
  margin-right: 12px; /* Increased space between icon and text */
  font-size: 1.3em; /* Slightly larger icon */
  color: var(--primary-color); /* Color icons */
  transition: color 0.3s ease;
  width: 1.2em; /* Give icon a fixed width for alignment */
  text-align: center; /* Center icon within its space */
}

.dashboard-nav a:hover {
  background-color: var(--secondary-color); /* Highlight on hover */
  color: var(--primary-color); /* Text color on hover */
  transform: translateX(5px); /* Subtle slide effect on hover */
}

.dashboard-nav a:hover i {
  color: var(--primary-color); /* Ensure icon color stays primary or changes */
}

/* Active sidebar link (requires JS to add a class) */
.dashboard-nav a.active-link {
  background-color: var(--primary-color);
  color: var(--button-primary-text); /* White or contrast color */
  font-weight: 700; /* Make active link bolder */
  box-shadow: 0 2px 5px
    color-mix(in srgb, var(--primary-color) 30%, transparent); /* Add subtle shadow */
  transform: translateX(0); /* Reset transform for active link */
}
.dark-mode .dashboard-nav a.active-link {
  box-shadow: 0 2px 5px
    color-mix(in srgb, var(--primary-color) 30%, #000000 50%); /* Dark mode shadow */
}
.dashboard-nav a.active-link i {
  color: var(--button-primary-text); /* White or contrast color */
}

/* Dashboard Content Area */
.dashboard-content {
  flex-grow: 1; /* Allow content to take up remaining space */
  /* Width is implicitly calculated by flexbox */
}

/* Dashboard Section Styles */
/* These are sections *within* the dashboard content area */
.dashboard-section {
  margin-bottom: 40px; /* Space between sections */
  text-align: left; /* Align content left */
}

.dashboard-section h2 {
  font-size: 2em; /* Smaller headings than main marketing page */
  margin-bottom: 25px; /* More space below heading */
  color: var(--primary-color); /* Ensure primary color */
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

/* Overview Section Specifics */
.overview-grid {
  display: grid;
  gap: 25px; /* Gap between overview cards */
  grid-template-columns: repeat(
    auto-fit,
    minmax(220px, 1fr)
  ); /* Responsive grid for overview cards */
}

.overview-card.glow-card {
  padding: 25px; /* Padding for overview cards */
  text-align: center;
}

.overview-card h3 {
  font-size: 1.3em; /* Slightly larger */
  margin-bottom: 15px;
  color: var(--primary-color);
  font-weight: 600;
}

.overview-card p {
  font-size: 1.05em; /* Slightly larger */
  margin-bottom: 18px;
  color: var(--text-color);
  line-height: 1.6;
}

.overview-card .text-primary {
  color: var(--primary-color); /* Highlight specific text */
  font-weight: 600;
}
/* Status styling within overview */
.overview-card .status-active,
.overview-card .status-pending,
.overview-card .status-expired,
.overview-card .status-cancelled,
.overview-card .status-failed,
.overview-card .status-other {
  font-weight: bold;
}

.overview-card .btn-small {
  padding: 8px 18px; /* Adjusted padding */
  font-size: 0.95em;
}

/* --- My Plans Section Specifics --- */

/* Container for listing user plans */
.user-plans-list {
  display: flex;
  flex-direction: column;
  gap: 35px; /* Space between individual plan cards */
}

/* Individual Plan Card */
.current-plan-card.glow-card {
  padding: 30px; /* Padding for the whole plan card */
  text-align: left; /* Override glow-card center alignment */
  display: flex; /* Use flexbox to layout summary and actions */
  flex-direction: column; /* Stack summary and actions vertically */
  gap: 30px; /* Space between summary and actions group */
}

/* Flex container for details and summary actions within the card */
.plan-summary-details {
  display: flex;
  flex-direction: column; /* Stack details and buttons vertically */
  gap: 25px; /* Space between details list and actions */
}

/* List of plan attributes */
.plan-details-list {
  margin-bottom: 0; /* Remove margin */
  padding-left: 5px; /* Slight indent */
}

.plan-details-list p {
  margin-bottom: 10px; /* Closer spacing for list items */
  font-size: 1em;
  color: var(--text-color);
  line-height: 1.6;
  display: flex; /* Align label and value */
  align-items: flex-start;
}

.plan-details-list p strong {
  font-weight: 600;
  color: var(--primary-color);
  min-width: 130px; /* Align values vertically */
  display: inline-block;
  margin-right: 8px;
  flex-shrink: 0;
}
.plan-details-list p small {
  font-size: 0.9em;
  color: color-mix(in srgb, var(--text-color) 80%, transparent);
  word-break: break-all; /* Prevent long IDs/keys from breaking layout */
}
.plan-details-list p progress {
  width: 100%;
  height: 8px;
  margin-top: 5px;
  border-radius: 4px;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background-color: var(--secondary-color); /* Add background for the track */
}
progress::-webkit-progress-bar {
  background-color: var(--secondary-color);
  border-radius: 4px;
}
progress::-webkit-progress-value {
  background-color: var(--primary-color);
  border-radius: 4px;
  transition: background-color 0.5s ease;
}
progress::-moz-progress-bar {
  background-color: var(--primary-color);
  border-radius: 4px;
  transition: background-color 0.5s ease;
}

/* Container for buttons under plan summary */
.plan-summary-actions {
  display: flex; /* Layout buttons horizontally */
  gap: 10px; /* Slightly smaller gap */
  flex-wrap: wrap; /* Allow buttons to wrap */
  margin-top: 15px; /* Add some space above the buttons */
  padding-top: 15px; /* Add space */
  border-top: 1px solid var(--border-color); /* Separator */
}

.plan-summary-actions .btn,
.plan-summary-actions .btn-small {
  margin-top: 5px; /* Add a small top margin for wrapped items */
  margin-right: 0;
  vertical-align: middle;
}

.download-config-btn i {
  margin-right: 6px; /* Space between icon and text */
  font-size: 0.9em; /* Slightly smaller icon */
}

/* Container for Plan Actions (Extend, Bandwidth) - toggled section */
.plan-actions-group {
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px dashed var(--border-color);
}

.plan-actions-group h4 {
  font-size: 1.4em;
  margin-bottom: 25px;
  color: var(--primary-color);
  font-weight: 600;
}

/* Individual Action Forms (Extend, Bandwidth) */
.plan-action-form {
  margin-bottom: 25px;
  padding: 25px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--secondary-color);
}
.plan-action-form:last-child {
  margin-bottom: 0;
}

.plan-action-form h5 {
  font-size: 1.25em;
  margin-bottom: 15px;
  color: var(--primary-color);
  font-weight: 600;
}

.plan-action-form p {
  margin-bottom: 20px;
  color: var(--text-color);
  font-size: 0.95em;
}

.extend-plan-form .form-group,
.bandwidth-form .form-group {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.extend-plan-form label,
.bandwidth-form label {
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.95em;
  flex-shrink: 0;
}

.extend-plan-form input[type="number"],
.bandwidth-form input[type="number"] {
  max-width: 100px;
  padding: 10px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background-color: var(--input-background);
  color: var(--text-color);
  font-size: 1em;
  transition: border-color 0.3s ease, background-color 0.5s ease,
    box-shadow 0.2s ease;
}

.extend-plan-form input[type="number"]:focus,
.bandwidth-form input[type="number"]:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 5px color-mix(in srgb, var(--primary-color) 30%, transparent);
  outline: none;
}

.extend-plan-form button,
.bandwidth-form button {
  margin-left: auto;
}

/* Downloads Section Specifics */
.download-list.glow-card {
  padding: 30px;
  text-align: left;
}

.download-list h3 {
  font-size: 1.4em;
  margin-bottom: 20px;
  color: var(--primary-color);
}

.download-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.download-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 1.05em;
  flex-wrap: wrap;
  gap: 10px;
}

.download-list li:last-child {
  border-bottom: none;
}

.download-list li i.fab,
.download-list li i.fas {
  margin-right: 12px;
  color: var(--primary-color);
  font-size: 1.4em;
  width: 1.5em;
  text-align: center;
}

.download-list li .btn-small {
  padding: 6px 15px;
  font-size: 0.9em;
  margin-left: auto;
  flex-shrink: 0;
}
.download-list li .btn-small i.fas {
  font-size: 0.9em;
  margin-left: 6px;
  margin-right: 0;
  width: auto;
}

/* --- Support Tickets Section Specifics --- */
/* --- (NEW STYLES FOR DASHBOARD.HTML) --- */
.ticket-section.glow-card {
  /* General styling for ticket cards */
  padding: 30px;
  margin-bottom: 30px;
  text-align: left;
}

.ticket-section h3 {
  /* Headings within ticket cards */
  font-size: 1.6em; /* Slightly larger than plan action headings */
  margin-bottom: 20px;
  color: var(--primary-color);
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-color);
}

/* New Ticket Form Styling */
.new-ticket-form .form-group {
  margin-bottom: 20px;
}

.new-ticket-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-color);
}

.new-ticket-form input[type="text"],
.new-ticket-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background-color: var(--input-background);
  color: var(--text-color);
  font-size: 1em;
  transition: border-color 0.3s ease, background-color 0.5s ease,
    box-shadow 0.2s ease;
}

.new-ticket-form textarea {
  min-height: 120px;
  resize: vertical;
}

.new-ticket-form input[type="text"]:focus,
.new-ticket-form textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 5px color-mix(in srgb, var(--primary-color) 30%, transparent);
  outline: none;
}
.dark-mode .new-ticket-form input:focus,
.dark-mode .new-ticket-form textarea:focus {
  box-shadow: 0 0 5px color-mix(in srgb, var(--primary-color) 30%, #000000 50%);
}

.new-ticket-form button#submit-new-ticket-btn {
  margin-top: 10px;
  padding: 12px 25px; /* Consistent button padding */
}

/* Ticket List Styling */
#user-tickets-list-container {
  margin-top: 20px;
}
#user-tickets-list-container p#loading-tickets-message,
#user-tickets-list-container p#no-tickets-message {
  text-align: center;
  padding: 20px;
  font-style: italic;
  color: color-mix(in srgb, var(--text-color) 70%, var(--background-color));
}

.ticket-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ticket-list-item {
  /* Changed from .ticket-list li for more specificity */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 1em;
  flex-wrap: wrap;
  gap: 10px;
}

.ticket-list-item:last-child {
  border-bottom: none;
}

.ticket-list-item .ticket-info {
  flex-grow: 1;
  margin-right: 15px; /* LTR */
}
.rtl-active .ticket-list-item .ticket-info {
  margin-right: 0;
  margin-left: 15px;
}

.ticket-list-item .ticket-title {
  font-weight: 600;
  color: var(--primary-color);
  display: block;
  margin-bottom: 3px;
  font-size: 1.1em;
}
.ticket-list-item .ticket-number-display {
  font-size: 0.85em;
  color: color-mix(in srgb, var(--text-color) 70%, var(--background-color));
  display: block;
  margin-bottom: 5px;
}

.ticket-list-item .ticket-status-display {
  /* Re-using .status class from style.css */
  font-size: 0.85em;
  padding: 4px 10px;
  border-radius: 12px;
  margin-right: 10px; /* LTR */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: var(--secondary-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  white-space: nowrap;
  flex-shrink: 0;
}
.rtl-active .ticket-list-item .ticket-status-display {
  margin-right: 0;
  margin-left: 10px;
}
/* Specific status colors (reuse classes from style.css if defined there) */
.ticket-list-item .ticket-status-display.status-open {
  /* Match .status-open from style.css */
  /* Styles will be inherited if .status-open is defined globally */
}
.ticket-list-item .ticket-status-display.status-closed {
  /* Match .status-closed from style.css */
  /* Styles will be inherited */
}
/* Add status-pending_user_reply and status-pending_admin_reply if needed */
.ticket-list-item .ticket-status-display.status-pending_user_reply {
  background-color: rgba(59, 130, 246, 0.1); /* Example: Light blue */
  color: #2563eb;
  border-color: rgba(59, 130, 246, 0.3);
}
.dark-mode .ticket-list-item .ticket-status-display.status-pending_user_reply {
  background-color: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.3);
}
.ticket-list-item .ticket-status-display.status-pending_admin_reply {
  background-color: rgba(245, 158, 11, 0.1); /* Example: Light amber */
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.3);
}
.dark-mode .ticket-list-item .ticket-status-display.status-pending_admin_reply {
  background-color: rgba(251, 191, 36, 0.15);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.3);
}

.ticket-list-item .btn-small {
  padding: 6px 15px;
  font-size: 0.9em;
  flex-shrink: 0;
}
/* --- END OF NEW TICKET SYSTEM STYLES --- */

/* Placeholder Sections */
.settings-content.glow-card,
.billing-content.glow-card {
  padding: 30px;
}

/* Hide placeholder sections by default */
#settings,
#billing {
  display: none;
}

.rtl-active .plan-details-list p strong {
  margin-left: 8px;
  margin-right: 0;
}

.rtl-active .extend-plan-form .form-group,
.rtl-active .bandwidth-form .form-group {
  /* No changes needed if flex-start is default */
}

.rtl-active .extend-plan-form button,
.rtl-active .bandwidth-form button {
  margin-left: 0;
  margin-right: auto;
}

.rtl-active .extend-plan-form label,
.rtl-active .bandwidth-form label {
  text-align: right;
}

/* --- Responsive Design for Dashboard --- */
@media (max-width: 992px) {
  /* Tablet breakpoint */
  .overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  .plan-details-list p strong {
    min-width: 110px;
  }
}

@media (max-width: 900px) {
  /* Breakpoint where sidebar stacks */
  .dashboard-container {
    flex-direction: column;
    gap: 25px;
  }
  .sidebar {
    width: 100%;
    position: static;
    max-height: none;
    overflow-y: visible;
    top: auto;
  }
  .dashboard-content {
    width: 100%;
  }

  .plan-summary-actions {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .plan-summary-actions .btn,
  .plan-summary-actions .btn-small {
    width: 100%;
    margin-top: 10px;
    text-align: center;
    box-sizing: border-box;
  }
  .plan-summary-actions .btn:first-child,
  .plan-summary-actions .btn-small:first-child {
    margin-top: 0;
  }

  .download-list li,
  .ticket-list-item {
    /* Updated selector */
    /* Keep flex, allow wrap */
  }
  .download-list li .btn-small,
  .ticket-list-item .btn-small {
    /* Updated selector */
    margin-left: auto; /* LTR */
  }
  .rtl-active .download-list li .btn-small,
  .rtl-active .ticket-list-item .btn-small {
    margin-left: 0;
    margin-right: auto;
  }

  .ticket-list-item .ticket-info {
    /* Updated selector */
    margin-right: 0; /* LTR */
    flex-basis: 100%;
    margin-bottom: 5px;
  }
  .rtl-active .ticket-list-item .ticket-info {
    margin-left: 0;
  }
  .ticket-list-item .ticket-status-display {
    /* Updated selector */
    margin-right: 5px; /* LTR */
  }
  .rtl-active .ticket-list-item .ticket-status-display {
    margin-left: 5px;
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  /* Smaller mobile breakpoint */
  .dashboard-page {
    padding-top: 80px;
  }
  .sidebar {
    padding: 15px;
  }
  .dashboard-nav a {
    padding: 10px 12px;
  }
  .dashboard-nav a i {
    font-size: 1.2em;
    margin-right: 10px; /* LTR */
  }
  .rtl-active .dashboard-nav a i {
    margin-right: 0;
    margin-left: 10px;
  }

  .overview-card.glow-card,
  .current-plan-card.glow-card,
  .plan-action-form,
  .download-list.glow-card,
  .ticket-section.glow-card, /* Added */
  .settings-content.glow-card,
  .billing-content.glow-card {
    padding: 20px;
  }
  .dashboard-section h2 {
    font-size: 1.8em;
  }
  .overview-card h3 {
    font-size: 1.2em;
  }
  .current-plan-card h3 {
    font-size: 1.3em;
  }
  .plan-actions-group h4 {
    font-size: 1.3em;
  }
  .plan-action-form h5 {
    font-size: 1.15em;
  }
  .download-list h3,
  .ticket-section h3 {
    /* Added */
    font-size: 1.3em;
  }
  .plan-details-list p strong {
    min-width: 100px;
    margin-right: 5px; /* LTR */
  }
  .rtl-active .plan-details-list p strong {
    margin-right: 0;
    margin-left: 5px;
  }
  .extend-plan-form .form-group,
  .bandwidth-form .form-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  .extend-plan-form input[type="number"],
  .bandwidth-form input[type="number"] {
    max-width: 100%;
  }
  .extend-plan-form button,
  .bandwidth-form button {
    margin-left: 0; /* LTR */
    margin-top: 10px;
    width: 100%;
  }
  .rtl-active .extend-plan-form button,
  .rtl-active .bandwidth-form button {
    margin-right: 0;
  }
}

@media (max-width: 480px) {
  .dashboard-page {
    padding-top: 70px;
  }
  .overview-grid {
    grid-template-columns: 1fr;
  }
  .plan-details-list p {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }
  .plan-details-list p strong {
    min-width: auto;
    margin-bottom: 2px;
  }
  .ticket-list-item {
    /* Updated selector */
    padding: 15px 0;
  }
  .ticket-list-item .ticket-status-display {
    /* Updated selector */
    font-size: 0.8em;
    padding: 3px 8px;
  }
  /* In dashboard.css or style.css */
  .username-highlight {
    color: var(
      --primary-color
    ); /* Or any color you prefer, e.g., #FFD700 for gold */
    font-weight: 600; /* Optional: make it bold */
  }

  /* Ensure the welcome message container allows inline elements to sit nicely */
  #welcome-message-container {
    display: inline; /* Or flex, adjust as needed for your layout */
  }
}
