@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@300;400;700&family=Roboto:wght@300;400;500;700&display=swap');

:root {
  --primary-red: #c9302c;
  --primary-red-hover: #ac2925;
  --dark-bg: #222;
  --light-gray: #f5f5f5;
  --border-color: #ddd;
  --text-color: #333;
  --muted-color: #777;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-color);
  background-color: #fdfdfd;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrapper {
  flex: 1;
}

h1, h2, h3, .oswald {
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
}

.w300 { font-weight: 300; }
.w400 { font-weight: 400; }
.w700 { font-weight: 700; }
.c666 { color: #666; }
.c999 { color: #999; }
.red-text { color: var(--primary-red); }

/* Хедер и навигация */
.navbar-static-top {
  background: #ffffff;
  border-bottom: 2px solid #e7e7e7;
  margin-bottom: 30px;
  padding: 10px 0;
}

.navbar-brand {
  font-family: 'Oswald', sans-serif;
  font-size: 26px;
  text-decoration: none;
  color: #333;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.navbar-brand:hover {
  text-decoration: none;
  color: #111;
}

.brand-badge {
  background: var(--primary-red);
  color: #fff;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: bold;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-links a {
  color: #555;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 4px;
  transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary-red);
  background: #f0f0f0;
}

.btn-nav-action {
  background-color: #2e6da4 !important;
  color: #fff !important;
}
.btn-nav-action:hover {
  background-color: #204d74 !important;
}

.btn-test-action {
  background-color: #398439 !important;
  color: #fff !important;
}
.btn-test-action:hover {
  background-color: #255625 !important;
}

/* Главный блок */
.main-block {
  text-align: center;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 15px;
}

.main-title {
  font-size: 32px;
  color: #444;
  margin-bottom: 25px;
}

/* Группа ввода email */
.email-input-container {
  display: flex;
  justify-content: center;
  align-items: stretch;
  max-width: 720px;
  margin: 0 auto 30px auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-radius: 6px;
  overflow: visible;
}

.email-input-box {
  flex: 1;
  position: relative;
  display: flex;
}

.email-username-input {
  flex: 1;
  height: 54px;
  padding: 10px 16px;
  font-size: 20px;
  font-weight: 500;
  border: 2px solid #ccc;
  border-right: none;
  border-radius: 6px 0 0 6px;
  outline: none;
  color: #222;
}

.email-username-input:focus {
  border-color: var(--primary-red);
}

.email-domain-selector {
  position: relative;
}

.domain-btn {
  height: 54px;
  padding: 0 18px;
  font-size: 18px;
  font-weight: 600;
  background: #f8f8f8;
  border: 2px solid #ccc;
  border-right: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #333;
}

.domain-btn:hover {
  background: #eee;
}

.copy-btn {
  height: 54px;
  padding: 0 26px;
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  background: var(--primary-red);
  color: #fff;
  border: none;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 1px;
}

.copy-btn:hover {
  background: var(--primary-red-hover);
}

/* Выпадающий список доменов */
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  border-radius: 4px;
  min-width: 260px;
  z-index: 1000;
  display: none;
  padding: 6px 0;
  text-align: left;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  color: #333;
  text-decoration: none;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:hover {
  background: #f5f5f5;
  color: var(--primary-red);
}

.dropdown-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 6px 0;
}

.dropdown-action-item {
  font-weight: bold;
  color: #2e6da4;
}

/* Лоадер ожидания писем */
.waiting-box {
  margin: 40px 0;
  padding: 30px;
  background: #fafafa;
  border: 1px dashed #ccc;
  border-radius: 8px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #eee;
  border-top: 4px solid var(--primary-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.waiting-text {
  font-size: 18px;
  color: #555;
  margin: 0 0 10px 0;
}

.current-address-badge {
  display: inline-block;
  font-size: 20px;
  font-weight: bold;
  color: var(--primary-red);
  background: #fff;
  padding: 6px 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 8px;
}

/* Инбокс - Таблица сообщений */
.inbox-container {
  max-width: 1050px;
  margin: 0 auto;
  padding: 0 15px;
}

.inbox-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--primary-red);
  color: #fff;
  font-family: 'Oswald', sans-serif;
  font-size: 16px;
  padding: 12px 20px;
  border-radius: 6px 6px 0 0;
  letter-spacing: 1px;
}

.inbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #ddd;
  border-top: none;
  background: #fff;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.inbox-item {
  border-bottom: 1px solid #eee;
  transition: background 0.15s;
}

.inbox-item:last-child {
  border-bottom: none;
}

.inbox-item-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.inbox-item-row:hover {
  background: #f8f9fa;
}

.inbox-item.active {
  background: #fffdf5;
  border-left: 4px solid var(--primary-red);
}

.col-sender {
  flex: 0 0 250px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 15px;
}

.col-subject {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 15px;
  color: #333;
}

.col-time {
  flex: 0 0 140px;
  text-align: right;
  color: #888;
  font-size: 13px;
}

/* Просмотр содержимого письма */
.message-detail-box {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-top: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  text-align: left;
}

.message-meta {
  padding: 20px;
  background: #fcfcfc;
  border-bottom: 1px solid #eee;
}

.meta-row {
  margin-bottom: 8px;
  display: flex;
  font-size: 14px;
}

.meta-row:last-child {
  margin-bottom: 0;
}

.meta-label {
  font-weight: bold;
  width: 90px;
  color: #555;
}

.meta-value {
  flex: 1;
  color: #222;
}

.meta-actions {
  margin-top: 15px;
  display: flex;
  gap: 10px;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

.btn-danger {
  background: #d9534f;
  color: #fff;
}
.btn-danger:hover { background: #c9302c; }

.attachments-container {
  padding: 12px 20px;
  background: #f5f8fa;
  border-bottom: 1px solid #e1e8ed;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #ccd6dd;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 13px;
  text-decoration: none;
  color: #1b95e0;
  font-weight: 500;
  transition: all 0.2s;
}

.attachment-chip:hover {
  background: #1b95e0;
  color: #fff;
  border-color: #1b95e0;
}

.message-body-frame {
  width: 100%;
  min-height: 350px;
  border: none;
  display: block;
}

/* Модальные окна */
.modal-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: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #fff;
  border-radius: 8px;
  width: 90%;
  max-width: 540px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform 0.2s;
}

.modal-overlay.show .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 16px 20px;
  background: #f8f8f8;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #999;
}

.modal-body {
  padding: 20px;
  text-align: left;
}

.modal-footer {
  padding: 14px 20px;
  background: #f8f8f8;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
}

.form-control:focus {
  border-color: #2e6da4;
}

/* Бейджи статусов */
.badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: bold;
  border-radius: 3px;
  text-transform: uppercase;
}

.badge-success { background: #5cb85c; color: #fff; }
.badge-warning { background: #f0ad4e; color: #fff; }
.badge-danger { background: #d9534f; color: #fff; }

/* Toast уведомления */
.toast-notification {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: #27ae60;
  color: #fff;
  padding: 14px 22px;
  border-radius: 6px;
  font-size: 15px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* Футер */
footer {
  margin-top: 50px;
  padding: 25px 0;
  border-top: 1px solid #eee;
  text-align: center;
  color: #888;
  font-size: 14px;
}

footer a {
  color: #555;
  text-decoration: none;
}

footer a:hover {
  color: var(--primary-red);
}

@media (max-width: 768px) {
  .email-input-container {
    flex-direction: column;
  }
  .email-username-input {
    border-radius: 6px 6px 0 0;
    border-right: 2px solid #ccc;
  }
  .domain-btn {
    border-right: 2px solid #ccc;
  }
  .copy-btn {
    border-radius: 0 0 6px 6px;
  }
  .col-sender {
    flex: 0 0 120px;
  }
  .col-time {
    display: none;
  }
}
