/* Email Reading Modal - Focused on Reading and Composing */
.reading-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 0.5rem;
}

.reading-modal {
  background: #161b22;
  color: #f0f6fc;
  border-radius: 8px;
  width: 98vw;
  height: 95vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Reading Modal Header */
.reading-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #30363d;
  background: #161b22;
  flex-shrink: 0;
}

.reading-email-subject {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reading-subject-label {
  font-size: 0.75rem;
  color: #8b949e;
  font-weight: 500;
}

.reading-subject-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f0f6fc;
}

.reading-close-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reading-close-btn:hover {
  background: #21262d;
  color: #f0f6fc;
}

/* Reading Modal Content */
.reading-modal-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 0.5rem;
}

/* Reading Email Main Area */
.reading-email-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Reading Email Thread */
.reading-email-thread {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  border-bottom: 1px solid #30363d;
  background: #161b22;
  display: flex;
  flex-direction: column;
}

.reading-email-message {
  margin: 0;
  padding: 1rem;
  border: none;
  border-radius: 0;
  background: transparent;
}

.reading-email-message.original {
  background: #fafbfc;
  border-radius: 8px;
  margin: 1rem;
  padding: 1.5rem;
  border: 1px solid #d1d9e0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.reading-message-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e1e4e8;
}

.reading-sender-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.reading-sender {
  font-weight: 600;
  color: #0366d6;
  font-size: 0.875rem;
}

.reading-timestamp {
  font-size: 0.75rem;
  color: #6a737d;
}

.reading-message-body {
  color: #24292f;
  font-size: 0.875rem;
  line-height: 1.6;
  background: transparent;
  padding: 1rem 0;
  border-radius: 0;
  font-family: inherit;
  max-height: none;
  overflow: visible;
  min-height: 2em;
}

/* Normalize HTML email content to reduce excessive spacing */
.reading-message-body p {
  margin: 0.5rem 0;
}

.reading-message-body p:first-child {
  margin-top: 0;
}

.reading-message-body p:last-child {
  margin-bottom: 0;
}

.reading-message-body p:empty {
  display: none;
}

.reading-message-body br {
  line-height: 1.2;
}

.reading-message-body div {
  margin: 0;
  padding: 0;
}

.reading-message-body div:empty {
  display: none;
}

.reading-message-body table {
  margin: 0.5rem 0;
  border-collapse: collapse;
}

.reading-message-body td, .reading-message-body th {
  padding: 0.25rem;
  vertical-align: top;
}

.reading-message-body tr:empty {
  display: none;
}

.reading-message-body td:empty, .reading-message-body th:empty {
  padding: 0;
  height: 0;
}

.reading-message-body * {
  max-width: 100%;
}

/* Hide excessive spacing elements */
.reading-message-body > br,
.reading-message-body > br + br,
.reading-message-body br + br + br {
  display: none;
}

/* Collapse multiple consecutive empty elements */
.reading-message-body div:empty + div:empty,
.reading-message-body p:empty + p:empty,
.reading-message-body td:empty + td:empty {
  display: none;
}

/* Reset margins on nested elements */
.reading-message-body table table {
  margin: 0;
}

.reading-message-body div div {
  margin: 0;
}

/* Reading Draft Compose Area */
.reading-draft-compose-area {
  flex: 0 0 auto;
  min-height: auto;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  background: #161b22;
  overflow: visible;
}

.reading-compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #30363d;
  background: #161b22;
}

.reading-compose-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f0f6fc;
}

.reading-compose-content {
  flex: 0 0 auto;
  padding: 0.75rem;
  overflow: visible;
}

.reading-draft-textarea {
  width: 100%;
  height: auto;
  min-height: 60px;
  max-height: 300px;
  padding: 0.75rem;
  border: 1px solid #30363d;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.6;
  resize: vertical;
  background: #0d1117;
  color: #f0f6fc;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  overflow-y: auto;
}

.reading-draft-textarea:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.1);
  background: #161b22;
}

.reading-draft-textarea::placeholder {
  color: #6e7681;
  font-style: italic;
}

/* Reading Settings Panel */
.reading-settings-panel {
  background: #21262d;
  border-left: 1px solid #30363d;
  transition: all 0.3s ease;
  overflow: hidden;
  flex-shrink: 0;
}

.reading-settings-panel.collapsed {
  width: 0;
  border-left: none;
}

.reading-settings-panel.expanded {
  width: 320px;
}

.reading-settings-panel-content {
  width: 320px;
  height: 100%;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.reading-settings-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.reading-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.reading-settings-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f0f6fc;
  margin: 0;
}

.reading-panel-collapse-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reading-panel-collapse-btn:hover {
  background: #30363d;
  color: #f0f6fc;
}

.reading-settings-field {
  display: flex;
  flex-direction: column;
}

.reading-settings-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #8b949e;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.reading-settings-textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #30363d;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1.5;
  resize: vertical;
  background: #0d1117;
  color: #f0f6fc;
  outline: none;
  min-height: 80px;
}

.reading-settings-textarea:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.1);
}

.reading-settings-textarea.readonly {
  background-color: #0d1117;
  color: #6e7681;
  cursor: not-allowed;
}

/* Reading Modal Footer */
.reading-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid #30363d;
  background: #161b22;
  gap: 1rem;
  flex: 0 0 auto;
}

.reading-compose-footer-left {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.reading-quick-action-btn {
  background: transparent;
  border: none;
  color: #58a6ff;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.reading-quick-action-btn:hover {
  background: rgba(88, 166, 255, 0.1);
  color: #79c0ff;
}

.reading-quick-action-btn.reading-delete-action {
  color: #f85149;
}

.reading-quick-action-btn.reading-delete-action:hover {
  background: rgba(248, 81, 73, 0.1);
  color: #ff7b72;
}

.reading-compose-footer-right {
  display: flex;
  align-items: center;
}

.reading-settings-toggle-btn {
  background: transparent;
  border: 1px solid #30363d;
  color: #8b949e;
  padding: 0.375rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.reading-settings-toggle-btn:hover {
  background: #21262d;
  color: #f0f6fc;
  border-color: #58a6ff;
}

.reading-send-btn {
  background: #58a6ff;
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reading-send-btn:hover:not(:disabled) {
  background: #1f6feb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.reading-send-btn:disabled {
  background: #30363d;
  color: #6e7681;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .reading-settings-panel.expanded {
    width: 280px;
  }
  
  .reading-settings-panel-content {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .reading-modal {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  
  .reading-modal-content {
    flex-direction: column;
  }
  
  .reading-settings-panel.expanded {
    width: 100%;
    height: 250px;
    border-left: none;
    border-top: 1px solid #30363d;
  }
  
  .reading-settings-panel.collapsed {
    height: 0;
    border-top: none;
  }
  
  .reading-settings-panel-content {
    width: 100%;
    height: 250px;
  }
  
  .reading-modal-footer {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  
  .reading-compose-footer-left {
    order: 2;
    justify-content: center;
  }
  
  .reading-compose-footer-right {
    order: 1;
    justify-content: center;
  }
  
  .reading-email-thread {
    min-height: 120px;
  }
  
  .reading-draft-textarea {
    min-height: 50px;
  }
} 