/*
 * Learnshala Meet Manager - Structural Stylesheet
 */

/* New Toolbar Layout */
#lsmm-toolbar {
  display: flex;
  flex-direction: column;
  gap: 15px;
  position: relative;
  margin-bottom: 20px;
}
.lsmm-primary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.lsmm-primary-row .lsmm-tabs {
  margin-left: auto;
  display: flex
}
#lsmm-secondary-row {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Wrapper */
#lsmm-wrapper {
  margin: 1em 0;
}

/* =======================================
   Filters and Controls
   ======================================= */
/* Container for the filter groups and buttons */
.lsmm-filters-container, .lsmm-past-actions-container {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 10px;
}

/* Individual filter group */
.lsmm-filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lsmm-filter-group label {
  white-space: nowrap;
  margin-bottom: 0;
}

.lsmm-filter-toggle {
    cursor: pointer;
}

.lsmm-filter-actions {
    display: flex;
}

/* =======================================
   Meeting List
   ======================================= */
.lsmm-items {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}

/* Meeting card */
.lsmm-item {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-style: solid;
  border-width: 1px;
  border-radius:8px;
  margin-bottom:12px;
  background-color:#fff;
  gap: 15px;
  flex-wrap: wrap;
}

.lsmm-item-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  max-width:425px;
  color: #222;
  
}

#ls-meeting-list .lsmm-item strong{
	color:#e67e22;
}

#ls-meeting-list .lsmm-item .title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 18px;
  margin-bottom:4px;
}

.lsmm-reschedule-remark{
    margin-top: 1px;
}

.lsmm-recurrence-summary-display,
.lsmm-exception-summary-display {
    display: block;
    font-size: 0.9em;
    color: #555;
    font-style: italic;
}

.lsmm-reschedule-remark{
    margin-top: 1px;
}

.lsmm-exception-remark-display {
    display: block;
    font-size: 0.9em;
    color: #555;
    margin-top: 4px;
}

.lsmm-reschedule-remark{
    margin-top: 1px;
}


.lsmm-item .time {
    color: #222;
}

.lsmm-item .actions {
  display: flex;
  gap: 8px;
}

.lsmm-item a.button span {
    color: inherit;
}
.lsmm-item a.button {
    text-decoration: none;
}

/* =======================================
   Reusable Dropdown Styles
   ======================================= */
.lsmm-past-tab-dropdown,
.lsmm-status-dropdown,
.lsmm-more-actions-dropdown {
  min-width: 200px;
  display: none;
  z-index: 9999;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  padding: 5px 0;
}

.lsmm-past-tab-dropdown a,
.lsmm-status-dropdown a,
.lsmm-more-actions-dropdown a {
  display: block;
  padding: 8px 15px;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
}

/* Specific positioning for dropdowns moved to body (Past Tab, Status Update) */
.lsmm-past-tab-dropdown,
.lsmm-status-dropdown {
  position: fixed; /* Positioned by JS relative to viewport */
}

  /* Past Tab Dropdown (Bulk Actions)*/
.lsmm-past-tab-wrapper {
  position: relative; /* Establishes a positioning context for the dropdown */
  display: inline-flex; /* Aligns the arrow and text properly */
  align-items: center;
}

.lsmm-past-tab-dropdown {
  min-width: 200px; /* Specific wider width for this dropdown */
  top:300px;
}

/* Add styles for the inner parts of the split control */
.lsmm-past-tab-wrapper .lsmm-tab-link,
.lsmm-past-tab-wrapper .lsmm-past-tab-arrow {
    cursor: pointer;
}

.lsmm-past-tab-wrapper .lsmm-past-tab-arrow {
    border-left: 1px solid rgba(0,0,0,0.1);
    padding-left: 8px;
}

/* "More Actions" Dropdown for individual meeting items */
.lsmm-more-actions {
  position: relative;
  display: inline-block;
  align-content: center;
}
.lsmm-more-actions-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: #555;
  padding: 0 5px;
}

.lsmm-more-actions-dropdown {
  position: absolute;
  right: 0; 
  top: 100%;
  margin-top: 2px;
  min-width: 160px;
}

.lsmm-split-button-primary {
  padding: 4px 8px;
  text-decoration: none;
  color: inherit;
}
.lsmm-split-button-arrow {
  cursor: pointer;
  padding: 4px;
  border-left: 1px solid rgba(0,0,0,0.1);
}

/* --- START: Status Badge Styles --- */
.lsmm-status-badge { display: inline-block; padding: 2px 8px; font-size: 11px; font-weight: bold; border-radius: 10px; color: #fff; margin-left: 8px; vertical-align: middle; }
.lsmm-badge-grey { background-color: #6c757d; }
.lsmm-badge-green { background-color: #28a745; }
.lsmm-badge-red { background-color: #dc3545; }
.lsmm-badge-yellow { background-color: #ffc107; color: #212529; }
/* --- START: Status Update Split Button --- */
.lsmm-status-actions-wrapper .lsmm-split-button-wrapper {
    color: #fff;
}
.lsmm-status-actions-wrapper .lsmm-split-button-arrow {
    border-left-color: rgba(255,255,255,0.3);
}
.lsmm-status-actions-wrapper .lsmm-badge-grey { background-color: #6c757d; }
.lsmm-status-actions-wrapper .lsmm-badge-green { background-color: #28a745; }
.lsmm-status-actions-wrapper .lsmm-badge-red { background-color: #dc3545; }
.lsmm-status-actions-wrapper .lsmm-badge-yellow { background-color: #ffc107; color: #212529; }
.lsmm-status-actions-wrapper .lsmm-badge-yellow .lsmm-split-button-arrow { border-left-color: rgba(0,0,0,0.2); }

.lsmm-status-dropdown {
  min-width: 120px; /* Specific narrower width for this dropdown */
}
/* --- END: Status Update Split Button --- */

/* =======================================
   Modals & Forms
   ======================================= */
.lsmm-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lsmm-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%; /* Changed from absolute to fixed for full coverage */
  background: rgba(0, 0, 0, 0.6);
  z-index: 1;
}

#lsmm-create-modal h3, 
#lsmm-edit-modal h3, 
#lsmm-reschedule-modal h3,
#lsmm-edit-scope-modal h3{
    color: #222;
}

#lsmm-reschedule-modal p{
    color: #555555;
}

.lsmm-modal-content {
  margin: 40px auto;
  padding: 20px;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 2;
  position: relative;
  background: #fff;
}

/* Form field styling for a stacked layout */
.lsmm-modal .lsmm-form .lsmm-form-field {
  display: block;
  margin-bottom: 12px;
}

.lsmm-modal .lsmm-form .lsmm-form-field > label {
  display: block;
  font-weight: normal;
  margin-bottom: 1px;
  color: #222;
}

.lsmm-form input[type="text"], .lsmm-form input[type="url"], .lsmm-form input[type="number"], .lsmm-form select, .lsmm-form textarea {
  width: 100%;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

.lsmm-modal .lsmm-actions {
  margin-top: 16px;
  display: flex;
  gap: 4px;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

/* Edit Scope Modal */
.lsmm-modal-content .lsmm-modal-close { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 24px; cursor: pointer; line-height: 1; padding: 0; }
.lsmm-scope-options { margin: 20px 0; }
.lsmm-scope-option { display: flex; align-items: flex-start; padding: 12px; margin-bottom: 10px; cursor: pointer; color:#222; font-weight: normal; }
.lsmm-scope-option input[type="radio"] { margin-top: 5px; margin-right: 15px; transform: scale(1.2); }
.lsmm-scope-option div { flex: 1; }
.lsmm-scope-option p { margin: 4px 0 0 0; }
#lsmm-edit-scope-modal .lsmm-scope-option strong {
    color: #222;
}

/* Recurrence options styling */
.lsmm-recurrence-options {
    display: none;
    padding: 10px;
    margin-bottom: 15px;
    margin-top: 10px;
}

.lsmm-recurrence-options h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

.lsmm-recurrence-options fieldset {
    margin: 8px 0;
}

.lsmm-recurrence-summary {
    font-style: italic;
    color: #555;
    margin-top: 5px;
}

.lsmm-modal .lsmm-recurrence-options h4,
.lsmm-modal .lsmm-recurrence-options fieldset legend,
.lsmm-modal .lsmm-recurrence-options fieldset legend strong {
    color: #111;
    font-size: 18px;
}

.lsmm-weekly-options, .lsmm-monthly-options {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.lsmm-target-search-container .lsmm-form-note,
.lsmm-target-search-container > label {
    color: #222;
}

.lsmm-search-results {
    color: #222;
}

/* Miscellaneous form text color fixes */
.lsmm-form .lsmm-inline span,
.lsmm-connection-status,
.lsmm-recurrence-options label,
.lsmm-recurrence-options span,
.lsmm-connection-status div,
.lsmm-connection-status span {
    color: #222;
}

.lsmm-connection-status a {
    color: #0073aa;
}

.lsmm-status-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 10px;
  color: #fff;
  margin-left: 8px;
  vertical-align: middle;
  width: fit-content;
}

/* Recurrence options layout refinement */
.lsmm-recurrence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.lsmm-monthly-day-of-month,
.lsmm-monthly-nth-weekday {
    display: inline-block;
    margin-left: 10px;
}
.lsmm-monthly-nth-weekday {
    display: none;
}

.lsmm-recurrence-grid .lsmm-form-field label {
  display: block;
  margin-bottom: 4px;
}

/* --- Pending Verification Alert --- */
/* Use the ID for higher specificity to override theme styles */
#lsmm-pending-alert.lsmm-alert {
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid #ffc107;
  background-color: #fff3cd;
  color: #856404;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Target the message span with high specificity to ensure it's visible against theme styles */
#lsmm-pending-alert.lsmm-alert .lsmm-alert-message {
  margin: 0;
  font-weight: bold;
  /* Add explicit properties to override aggressive theme defaults */
  color: inherit;
  display: block;
  flex-grow: 1; /* Allow the text to take up available space */
  padding-right: 15px; /* Add some space between text and button */
}

/* Ensure alert is above toolbar */
#lsmm-pending-alert {
  order: -1; /* This is for flexbox context if wrapper becomes one */
}

/* --- Recurrence Exceptions UI --- */
.lsmm-exceptions-container {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.lsmm-exceptions-toggle {
    text-decoration: none;
    font-weight: bold;
    color: #2271b1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lsmm-exceptions-content {
    padding: 10px;
    border: 1px solid #ddd;
    margin-top: 5px;
    background: #f9f9f9;
}

.lsmm-exception-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.lsmm-exception-input-wrapper {
    flex-grow: 1;
}

.lsmm-exception-input-wrapper .lsmm-exception-input {
    width: 100%;
}

.lsmm-exceptions-summary {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ccc;
    color: #222;
}

/* =======================================
   Responsiveness
   ======================================= */

/* This single media query will handle all screens narrower than 800px */
@media (max-width: 800px) {
  /* Stack the main filter controls for mobile */
  .lsmm-filters-container {
    flex-direction: column;
    align-items: stretch;
  }

  .lsmm-filter-actions {
    justify-content: flex-start;
    width: 100%;
  }
  
  .lsmm-filter-group {
    flex-direction: column;
    align-items: stretch;
  }

  /* Force the meeting list item to stack vertically */
  .lsmm-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  /* Make the info, time, and actions sections take up the full width */
  .lsmm-item-info,
  .lsmm-item .actions {
    width: 100%;
  }

  .lsmm-item-info {
    max-width: none; /* Override the desktop max-width on small screens */
    margin-right: 0;
    margin-bottom: 8px;
  }

  .lsmm-item .time {
    margin-bottom: 8px;
    white-space: normal; /* This ensures the long date/time text can wrap */
  }

  .lsmm-item .actions {
    justify-content: flex-start;
    margin-top: 8px;
  }
}