* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-box h1 {
  color: #2c5282;
  margin-bottom: 5px;
}

.login-box .subtitle {
  color: #666;
  margin-bottom: 30px;
}

/* Main Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #2c5282;
}

header h1 {
  color: #2c5282;
}

/* Cards */
.card {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.card h2 {
  color: #2c5282;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.section-header h2 {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #444;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: #2c5282;
}

.checkbox-group {
  display: flex;
  align-items: center;
  padding-top: 25px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.hint {
  display: block;
  font-size: 12px;
  color: #666;
  margin-top: 5px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary {
  background: #2c5282;
  color: white;
}

.btn-primary:hover {
  background: #1a365d;
}

.btn-secondary {
  background: #718096;
  color: white;
}

.btn-secondary:hover {
  background: #4a5568;
}

.btn-small {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-danger {
  background: #e53e3e;
  color: white;
}

.btn-danger:hover {
  background: #c53030;
}

/* Messages */
.message {
  padding: 10px 15px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.message.success {
  background: #c6f6d5;
  color: #22543d;
}

.message.error {
  background: #fed7d7;
  color: #742a2a;
}

.error-message {
  background: #fed7d7;
  color: #742a2a;
  padding: 10px 15px;
  border-radius: 4px;
  margin-bottom: 15px;
}

/* Info Grid */
.info-grid {
  display: grid;
  gap: 15px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.info-item label {
  font-weight: 500;
  margin-bottom: 0;
  min-width: 120px;
}

.info-item code {
  background: #edf2f7;
  padding: 5px 10px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  word-break: break-all;
}

.info-item span {
  color: #666;
}

/* Status Card */
.status-card {
  border-left: 4px solid #2c5282;
}

.status-card.paused {
  border-left-color: #ed8936;
  background: #fffaf0;
}

.status-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #48bb78;
  animation: pulse 2s infinite;
}

.status-card.paused .status-dot {
  background: #ed8936;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  font-size: 18px;
  font-weight: 500;
}

.paused-info {
  margin-top: 15px;
  color: #744210;
  font-size: 14px;
}

/* Button variants */
.btn-warning {
  background: #ed8936;
  color: white;
}

.btn-warning:hover {
  background: #dd6b20;
}

.btn-success {
  background: #48bb78;
  color: white;
}

.btn-success:hover {
  background: #38a169;
}

.btn-light {
  background: #e2e8f0;
  color: #4a5568;
}

.btn-light:hover {
  background: #cbd5e0;
}

/* Dialog */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.dialog {
  background: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.dialog-wide {
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
}

.dialog h3 {
  margin-bottom: 15px;
  color: #2c5282;
}

.dialog p {
  margin-bottom: 20px;
  color: #4a5568;
}

.dialog-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dialog-buttons .btn {
  flex: 1;
  min-width: 120px;
}

/* Input with checkbox */
.input-with-checkbox {
  display: flex;
  gap: 15px;
  align-items: center;
}

.input-with-checkbox input[type="number"] {
  flex: 1;
}

.inline-checkbox {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  margin-bottom: 0;
}

.inline-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

/* Textarea */
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: monospace;
  resize: vertical;
  transition: border-color 0.2s;
}

textarea:focus {
  outline: none;
  border-color: #2c5282;
}

/* Version badges */
.version-badge {
  background: #edf2f7;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.version-badge.match {
  background: #c6f6d5;
  color: #22543d;
}

.version-badge.mismatch {
  background: #fed7d7;
  color: #742a2a;
}

.version-warning {
  color: #c53030;
  font-size: 13px;
  margin-left: 5px;
}

/* Client Error Display */
.client-error {
  margin-top: 15px;
  padding: 12px 15px;
  background: #fed7d7;
  border: 1px solid #feb2b2;
  border-radius: 6px;
  border-left: 4px solid #c53030;
}

.client-error-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #742a2a;
}

.client-error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #c53030;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}

.client-error-message {
  color: #742a2a;
  margin: 0;
  font-size: 14px;
  word-break: break-word;
}

.client-error-time {
  display: block;
  margin-top: 6px;
  color: #9b2c2c;
  font-size: 12px;
}

/* =====================
   Mailbox Cards
   ===================== */

.mailbox-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-text,
.loading-text,
.error-text {
  color: #666;
  font-style: italic;
  padding: 20px 0;
  text-align: center;
}

.error-text {
  color: #c53030;
}

.mailbox-card {
  border: 1px solid #e2e8f0;
  border-left: 4px solid #48bb78;
  border-radius: 6px;
  padding: 15px 18px;
  background: #fafafa;
  transition: box-shadow 0.2s;
}

.mailbox-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mailbox-card.disabled {
  border-left-color: #a0aec0;
  opacity: 0.7;
}

.mailbox-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.mailbox-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot-small {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #48bb78;
  flex-shrink: 0;
}

.status-dot-small.disabled {
  background: #a0aec0;
}

.mailbox-status-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.mailbox-status-badge.active {
  background: #c6f6d5;
  color: #22543d;
}

.mailbox-status-badge.disabled {
  background: #e2e8f0;
  color: #4a5568;
}

.mailbox-card-actions {
  display: flex;
  gap: 6px;
}

.mailbox-card-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
  font-size: 13px;
  color: #4a5568;
}

@media (max-width: 600px) {
  .mailbox-card-info {
    grid-template-columns: 1fr;
  }
}

.info-label {
  font-weight: 500;
  color: #2d3748;
}

.mailbox-error {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fed7d7;
  border: 1px solid #feb2b2;
  border-radius: 4px;
  border-left: 3px solid #c53030;
}
