/* В начале styles/main.css */
:root {
  /* базовые цвета для светлой темы */
  --bg: #ffffff;
  --fg: #333333;
  --border: #ccc;
  --muted: #777;
  --shadow: rgba(0, 0, 0, 0.1);
}

body.dark-theme {
  /* цвета тёмной темы */
  --bg: #1e1e1e;
  --fg: #e0e0e0;
  --border: #444;
  --muted: #aaa;
  --shadow: rgba(0, 0, 0, 0.5);
}

body {
  background-color: var(--bg);
  color: var(--fg);
  transition: background-color .3s, color .3s;
}

/* SVG-иконки, чтобы они брали цвет текста */
svg {
  stroke: currentColor !important;
  fill: none !important;
  transition: color .3s;
}

/*headers*/
.header-with-search {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 16px;
  border: 2px solid var(--border);
  /* Добавляем серую рамку */
  box-shadow: 0 2px 5px var(--shadow);
  z-index: 1000;
}

.header-container {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  max-width: 1200px;
}

.left-icon {
  width: 40px;
  height: 40px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  /* Сделал границу толще */
  cursor: pointer;
  color: var(--fg);
  box-shadow: 0 6px 16px var(--shadow);
  /* Увеличена тень */
  transition: all 0.2s ease;
}

.left-icon img {
  width: 20px;
  height: 20px;
}

.search-input {
  background-color: var(--bg);
  color: var(--fg);
  flex-grow: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  outline: none;
  font-size: 14px;
}

.icon-button {
  font-size: 24px;
  margin-left: 12px;
  cursor: pointer;
  user-select: none;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  width: 40px;
  border-radius: 50%;
  color: var(--fg);
  background-color: var(--bg);
}

.floating-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background-color: var(--bg);
  border: 2px solid var(--border);
  /* Добавляем серую рамку */
  border-radius: 12px;
  /* Увеличиваем тень */
  box-shadow: 0 4px 12px var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1000;
  transition: box-shadow 0.2s, transform 0.2s;
  color: var(--fg);
}

.floating-button:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.floating-button img {
  width: 24px;
  height: 24px;
}

/*passwords*/

#passwords {
  max-width: 1200px;
  width: 100%;
  box-sizing: border-box;
}

.password-group {
  padding: 16px;
  border-bottom: 1px solid #ddd;
}

.group-date {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
  padding-left: 4px;
}

.password-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e0e0e0;
  flex-shrink: 0;
  margin-right: 12px;
}

.password-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.password-title {
  font-weight: 500;
  font-size: 16px;
  color: var(--fg);
}

.password-login {
  font-size: 13px;
  color: var(--muted);
}

/*main*/
main {
  margin-top: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal */

@media (max-width: 480px) {
  #theme-toggle {
    display: none;
  }

  .modal {
    align-items: flex-end; /* чтобы контент оказался внизу */
  }

  .modal-content {
    position: fixed;
    border: var(--bg) !important;
    border-radius: 12px 12px 0 0 !important;
    right: 0;
    left: 0;
    bottom: 0;
    padding: 16px;
    font-size: 14px;
    max-width: 100%;
    width: 100%;
    margin: 0;
    box-shadow: 0 -2px 12px var(--shadow); /* тень наверх */
    animation: slideUp 0.3s ease-out;
    transition: transform 0.3s ease;
  }

  .form-group label {
    font-size: 13px;
  }

  .generated-password {
    font-size: 15px;
    padding: 8px;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.7);
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg);
  border-radius: 12px;
  margin: 0px;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 90%;
  box-sizing: border-box;
  overflow-y: auto;
  box-shadow: 0 4px 12px var(--shadow);
  border: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1002;
  pointer-events: auto;
}



.close-button {
  align-self: flex-end;
  font-size: 24px;
  cursor: pointer;
  user-select: none;
  margin-bottom: -10px;
}

.generated-password {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 500;
  font-size: 16px;
  text-align: center;
  color: var(--fg);
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  min-height: 48px;
  font-family: 'Roboto', sans-serif;
}

.generated-password.copied {
  animation: flashBg 0.8s ease;
}

@keyframes flashBg {
  0% {
    background-color: rgba(0, 255, 0);
  }

  100% {
    background-color: var(--bg);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  color: var(--fg);
}

.form-group input[type="range"],
.form-group input[type="text"] {
  margin-top: 4px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;

  /* Иконка стрелки */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-arrow-down-circle'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='8 12 12 16 16 12'%3E%3C/polyline%3E%3Cline x1='12' y1='8' x2='12' y2='16'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  padding-right: 36px;

  background-color: var(--bg);
  /* border: 1px solid #ccc; */
  border: 1px solid var(--border);
  /* color: #333; */
  color: var(--fg);
}

body.dark-theme select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23e0e0e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-arrow-down-circle'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='8 12 12 16 16 12'%3E%3C/polyline%3E%3Cline x1='12' y1='8' x2='12' y2='16'%3E%3C/line%3E%3C/svg%3E");
}

select:focus {
  outline: none;
  border-color: #999;
  box-shadow: 0 0 0 2px rgba(100, 100, 255, 0.2);
}

select option {
  color: var(--fg);
  background: var(--bg);
}

.form-group select {
  margin-top: 4px;
}

.digit {
  color: red;
  font-family: 'Roboto Mono', monospace;
}

/* Корневой контейнер переключателя */
.toggle-group {
  min-height: 28px;
  display: flex;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  /* Чтобы скругления работали на всей группе */
  box-shadow: 0 2px 5px var(--shadow);
}

/* Прячем сами радио-кнопки */
.toggle-group input[type="radio"] {
  display: none;
}

/* Общий стиль для каждой "кнопки" */
.toggle-group label {
  flex: 1;
  padding: 8px 16px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  background-color: var(--border);
  color: var(--fg);
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

/* Разделитель между кнопками */
.toggle-group label+label {
  border-left: 1px solid var(--border);
}

/* Стили для выбранной кнопки */
.toggle-group input:checked+label {
  background-color: var(--bg);
  color: var(--fg);
  box-shadow: inset 0 0 5px var(--shadow);
  transform: none;
}

/* Опционально: скругления для крайних кнопок */
.toggle-group label:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.toggle-group label:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}