:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --dark: #1e293b;
  --darker: #0f172a;
  --light: #f8fafc;
  --gray: #64748b;
  --light-gray: #e2e8f0;
  --card-bg: rgba(255, 255, 255, 0.95);
  --success: #10b981;
  --error: #ef4444;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, var(--darker), var(--dark));
  color: var(--dark);
  min-height: 100vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

header {
  text-align: center;
  padding: 30px 0;
  margin-bottom: 20px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.logo i {
  font-size: 2.5rem;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

h1 {
  font-size: 2.8rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--light);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
}

@media (min-width: 768px) {
  .main-content {
    grid-template-columns: 1fr 1.5fr;
  }
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition);
}

.card:hover {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--light-gray);
}

.card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--darker);
  display: flex;
  align-items: center;
  gap: 10px;
}

.email-container {
  margin-bottom: 25px;
}

.email-address-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.email-address {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--darker);
  background: rgba(99, 102, 241, 0.1);
  padding: 12px 20px;
  border-radius: 12px;
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "Courier New", monospace;
}

.btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-sm {
  padding: 8px 15px;
  font-size: 0.9rem;
}

.btn-danger {
  background: var(--error);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-success {
  background: var(--success);
}

.btn-success:hover {
  background: #0da271;
}

.info-text {
  color: var(--gray);
  font-size: 0.9rem;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.control-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(226, 232, 240, 0.4);
  padding: 15px;
  border-radius: 12px;
}

.control-label {
  font-weight: 600;
  color: var(--darker);
  display: flex;
  align-items: center;
  gap: 10px;
}

.refresh-info {
  font-size: 0.9rem;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 5px;
}

.refresh-count {
  font-weight: 700;
  color: var(--primary);
  min-width: 20px;
  display: inline-block;
  text-align: center;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.message-list {
  max-height: 500px;
  overflow-y: auto;
  padding-right: 10px;
}

.message-list::-webkit-scrollbar {
  width: 8px;
}

.message-list::-webkit-scrollbar-track {
  background: rgba(226, 232, 240, 0.4);
  border-radius: 4px;
}

.message-list::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

.message {
  padding: 18px;
  border-radius: 12px;
  background: white;
  margin-bottom: 15px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--light-gray);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03);
  position: relative;
}

.message:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--primary);
}

.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.message-sender {
  font-weight: 700;
  color: var(--darker);
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-time {
  color: var(--gray);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.message-subject {
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 1.1rem;
  color: var(--dark);
}

.message-preview {
  color: var(--gray);
  font-size: 0.95rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-actions {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  gap: 8px;
}

.message-action-btn {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray);
  transition: var(--transition);
}

.message-action-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--darker);
}

.message-action-btn.delete:hover {
  color: var(--error);
}

.no-messages {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
}

.no-messages i {
  font-size: 3rem;
  margin-bottom: 15px;
  color: var(--light-gray);
}

.no-messages h3 {
  font-size: 1.4rem;
  margin-bottom: 10px;
  color: var(--dark);
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray);
}

.loading-spinner {
  border: 4px solid rgba(99, 102, 241, 0.2);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.error {
  text-align: center;
  padding: 30px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 12px;
  color: var(--error);
}

.error i {
  font-size: 2rem;
  margin-bottom: 15px;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  position: relative;
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 1.8rem;
  color: var(--gray);
  cursor: pointer;
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.close-modal:hover {
  background: var(--light-gray);
  color: var(--darker);
}

.modal-header {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--light-gray);
}

.modal-subject {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--darker);
  margin-bottom: 10px;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 5px;
  font-size: 0.95rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-label {
  color: var(--gray);
}

.meta-value {
  font-weight: 500;
  color: var(--dark);
}

.message-content {
  padding: 20px;
  background: var(--light);
  border-radius: 12px;
  line-height: 1.6;
}

.message-content p {
  margin-bottom: 15px;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--darker);
  color: white;
  padding: 15px 25px;
  border-radius: 12px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
  z-index: 2000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast i {
  font-size: 1.2rem;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--error);
}

.stats {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.stat-card {
  background: rgba(99, 102, 241, 0.1);
  border-radius: 12px;
  padding: 15px;
  flex: 1;
  min-width: 120px;
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 5px;
}

.stat-label {
  color: var(--gray);
  font-size: 0.9rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2.2rem;
  }

  .main-content {
    grid-template-columns: 1fr;
  }

  .stats {
    flex-direction: column;
  }
}
