/* Basic PWA Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #3b82f6;
  --background: #1a1a1a;
  --surface: #2a2a2a;
  --text: #ffffff;
  --text-secondary: #a0a0a0;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

h1, h2, h3 {
  margin-bottom: 1rem;
}

h1 {
  font-size: 2rem;
  color: var(--primary);
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

button, .btn-primary, .btn-secondary {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.2s;
  font-weight: 500;
}

button:hover, .btn-primary:hover {
  opacity: 0.9;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--error);
}

.btn-secondary:hover {
  opacity: 0.9;
}

/* Cards */
.card {
  background-color: var(--surface);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.card h2 {
  margin-top: 0;
}

.card ol, .card ul {
  margin-left: 20px;
  margin-bottom: 1rem;
}

.card li {
  margin-bottom: 0.5rem;
}

/* Notification card styles */
.notification-card {
  background-color: var(--surface);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.notification-header h3 {
  margin: 0;
  font-size: 18px;
}

.timestamp {
  font-size: 12px;
  color: var(--text-secondary);
}

.notification-description {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.notification-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.notification-actions button {
  padding: 8px 16px;
  font-size: 14px;
}

/* Status messages */
.status-message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 16px;
  margin-bottom: 16px;
  font-weight: 500;
}

.status-success {
  color: var(--success);
}

.status-error {
  color: var(--error);
}

.status-warning {
  color: var(--warning);
}

.status-message.status-success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success);
}

.status-message.status-error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error);
}

.status-message.status-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--warning);
}

/* Loading spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* iOS safe area handling */
@supports (padding: max(0px)) {
  body {
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

/* Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--surface);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Notification Sections */
.notification-section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.counter {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.btn-secondary-small {
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--text-secondary);
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary-small:hover {
  background-color: var(--error);
  border-color: var(--error);
  color: white;
}

.notification-list {
  min-height: 100px;
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-style: italic;
}

/* Button variants */
.btn-save {
  background-color: var(--success);
}

.btn-save:hover {
  opacity: 0.9;
}

.btn-delete {
  background-color: var(--error);
}

.btn-delete:hover {
  opacity: 0.9;
}

.btn-view {
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--text-secondary);
}

.btn-view:hover {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Status message container (for toast messages) */
#status-message-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

#status-message-container .status-message {
  margin: 0;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.status-message.status-info {
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--primary);
  color: var(--primary);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background-color: var(--surface);
  border-radius: 12px;
  padding: 32px;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal .close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 32px;
  font-weight: bold;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.modal .close:hover {
  color: var(--error);
}

.modal-subject {
  margin-top: 0;
  margin-bottom: 8px;
  color: var(--primary);
}

.modal-timestamp {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.modal-description {
  margin-bottom: 24px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

.modal-markdown-content {
  color: var(--text);
  line-height: 1.7;
}

/* Markdown content styling */
.modal-markdown-content h1,
.modal-markdown-content h2,
.modal-markdown-content h3 {
  color: var(--primary);
  margin-top: 24px;
  margin-bottom: 12px;
}

.modal-markdown-content h1 {
  font-size: 28px;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 8px;
}

.modal-markdown-content h2 {
  font-size: 24px;
}

.modal-markdown-content h3 {
  font-size: 20px;
}

.modal-markdown-content p {
  margin-bottom: 16px;
}

.modal-markdown-content ul,
.modal-markdown-content ol {
  margin-left: 24px;
  margin-bottom: 16px;
}

.modal-markdown-content li {
  margin-bottom: 8px;
}

.modal-markdown-content code {
  background-color: var(--background);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 14px;
}

.modal-markdown-content pre {
  background-color: var(--background);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.modal-markdown-content pre code {
  padding: 0;
  background: none;
}

.modal-markdown-content blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 16px;
  margin-left: 0;
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-style: italic;
}

.modal-markdown-content a {
  color: var(--primary);
  text-decoration: none;
}

.modal-markdown-content a:hover {
  text-decoration: underline;
}

.modal-markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.modal-markdown-content th,
.modal-markdown-content td {
  border: 1px solid var(--text-secondary);
  padding: 8px 12px;
  text-align: left;
}

.modal-markdown-content th {
  background-color: var(--background);
  font-weight: 600;
}

/* Responsive design */
@media (max-width: 600px) {
  .container {
    padding: 15px;
  }

  h1 {
    font-size: 1.75rem;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-actions {
    flex-direction: column;
    width: 100%;
  }

  button, .btn-primary, .btn-secondary {
    width: 100%;
    margin-bottom: 10px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-actions {
    width: 100%;
    justify-content: space-between;
  }

  .notification-actions {
    flex-direction: column;
  }

  .notification-actions button {
    width: 100%;
  }

  .modal-content {
    padding: 20px;
    max-width: 100%;
  }

  #status-message-container {
    left: 10px;
    right: 10px;
    max-width: none;
  }
}
