/**
 * Simple Message Dashboard - Mobile-First Styles
 * Z-index: dashboard (10000), settings drawer (11000)
 */

/* ============================================
   DASHBOARD ROOT & CONTAINER
   ============================================ */
#sm-dashboard-root {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

.sm-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid #e0e0e0;
}

.sm-dashboard-title {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

/* Settings icon button */
#sm-settings-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

#sm-settings-toggle:hover {
  background: #f5f5f5;
  border-color: #0073aa;
  color: #0073aa;
}

#sm-settings-toggle svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* ============================================
   PRIMARY CTA BUTTON - "Go Projects"
   ============================================ */
#sm-go-projects {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 16px 24px;
  background: #0073aa;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 24px;
  box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

#sm-go-projects:hover {
  background: #005a87;
  box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
}

#sm-go-projects:active {
  transform: scale(0.98);
}

/* ============================================
   SUMMARY COUNTERS
   ============================================ */
.sm-summary-section {
  margin-bottom: 32px;
}

.sm-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.sm-summary-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sm-summary-count {
  font-size: 32px;
  font-weight: 700;
  color: #0073aa;
  margin-bottom: 8px;
}

.sm-summary-label {
  font-size: 14px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   NOTIFICATIONS LIST
   ============================================ */
.sm-notifications-section {
  margin-bottom: 32px;
}

.sm-notifications-header {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
}

#sm-notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sm-note {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  min-height: 44px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sm-note:hover {
  border-color: #0073aa;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.sm-note:focus {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

.sm-note-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.sm-note-message {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

.sm-note-time {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.sm-no-notifications {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-style: italic;
}

/* ============================================
   SETTINGS DRAWER (OVERLAY + PANEL)
   ============================================ */

/* Overlay */
#sm-settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 11000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

#sm-settings-overlay.sm-open {
  opacity: 1;
  visibility: visible;
}

/* Drawer */
#sm-settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 400px;
  height: 100%;
  background: #fff;
  z-index: 11001;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.2);
}

#sm-settings-drawer.sm-open {
  transform: translateX(0);
}

/* Drawer header */
.sm-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.sm-settings-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

#sm-settings-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 24px;
  color: #666;
  transition: color 0.2s ease;
  padding: 0;
}

#sm-settings-close:hover {
  color: #0073aa;
}

/* Drawer body */
.sm-settings-body {
  padding: 20px;
}

.sm-settings-section {
  margin-bottom: 24px;
}

.sm-settings-section-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

.sm-setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  min-height: 44px;
}

.sm-setting-item:last-child {
  border-bottom: none;
}

.sm-setting-label {
  font-size: 14px;
  color: #333;
}

/* Toggle switch */
.sm-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.sm-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.sm-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 26px;
}

.sm-toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.sm-toggle input:checked + .sm-toggle-slider {
  background-color: #0073aa;
}

.sm-toggle input:checked + .sm-toggle-slider:before {
  transform: translateX(22px);
}

.sm-toggle input:disabled + .sm-toggle-slider {
  background-color: #e0e0e0;
  cursor: not-allowed;
}

/* Logout button */
#sm-logout {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: #dc3232;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-top: 24px;
  min-height: 44px;
}

#sm-logout:hover {
  background: #c12121;
}

/* Prevent body scroll when drawer open */
body.sm-settings-no-scroll {
  overflow: hidden;
}

/* ============================================
   MOBILE RESPONSIVE (SMALL SCREENS)
   ============================================ */
@media (max-width: 768px) {
  #sm-dashboard-root {
    padding: 12px;
  }
  
  .sm-dashboard-title {
    font-size: 20px;
  }
  
  #sm-go-projects {
    font-size: 16px;
    min-height: 48px;
    padding: 14px 20px;
  }
  
  .sm-summary-count {
    font-size: 28px;
  }
  
  .sm-summary-label {
    font-size: 13px;
  }
  
  .sm-notifications-header {
    font-size: 16px;
  }
  
  /* Full screen drawer on mobile */
  #sm-settings-drawer {
    max-width: 100%;
  }
}

/* ============================================
   ACCESSIBILITY & TOUCH ENHANCEMENTS
   ============================================ */

/* Focus visible styles */
button:focus-visible,
.sm-note:focus-visible {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

/* Ensure all interactive elements meet 44x44 minimum */
button,
.sm-note {
  min-width: 44px;
  min-height: 44px;
}

/* Prevent child elements from blocking pointer events */
.sm-note > *,
#sm-settings-toggle > *,
#sm-go-projects > * {
  pointer-events: none;
}

/* ============================================
   SUCCESS MESSAGE (TOAST)
   ============================================ */
.sm-success-message {
  animation: slideInFromRight 0.3s ease-out;
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============================================
   LOADING STATES
   ============================================ */
.sm-loading {
  opacity: 0.6;
  pointer-events: none;
}

.sm-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
