:root {
  --primary: #192f59;
  --accent: #dd3333;
  --white: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: #f6f8fb;
  color: var(--text);
}

.site-header {
  background: var(--primary);
  color: var(--white);
  padding: 16px 24px;
}

.site-footer {
  background: var(--primary);
  color: var(--white);
  padding: 20px 0;
}

.footer-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-left {
  display: flex;
  align-items: center;
}

.footer-text {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-right p {
  margin: 0;
  font-size: 14px;
}

.footer-right a {
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
}

.footer-right a:hover {
  color: var(--accent);
}

.site-footer p {
  margin: 0;
  font-size: 14px;
  text-align: center;
  color: var(--white);
  font-weight: 600;
}

.site-footer a {
  color: var(--white);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

.footer-link {
  color: var(--primary) !important;
}

.site-header .brand {
  max-width: 900px;
  margin: 0 auto;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-header .brand a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--white);
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.site-header .brand a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.site-header .brand a:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.site-header .brand a:hover::before {
  left: 100%;
}

.site-header .brand a:hover .brand-logo {
  transform: scale(1.1) rotate(5deg);
}

.site-header .brand a:hover span {
  color: #f0f9ff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.brand-logo {
  width: 48px;
  height: 32px;
  object-fit: cover;
  display: inline-block;
  transition: all 0.3s ease;
}

.container {
  max-width: 900px;
  margin: 24px auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
  padding: 20px;
}

h1 {
  font-size: 24px;
  margin: 4px 0 8px;
  color: var(--primary);
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.counter {
  color: #4c6cab;
  font-weight: 700;
  background: #eef2ff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 5px;
  white-space: nowrap;
}

.title-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 20px;
}

.note {
  color: var(--muted);
  margin-bottom: 16px;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid;
}

.alert.success {
  background: #f0f9ff;
  color: #059669;
  border-color: #a7f3d0;
}

.alert.error {
  background: #fff5f5;
  color: var(--accent);
  border-color: #ffd4d4;
}

form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-weight: 600;
  color: var(--primary);
}

.photo-upload {
  display: flex;
  align-items: center;
}

.photo-box {
  width: 180px;
  height: 180px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fafafa;
  cursor: pointer;
  position: relative;
}

.photo-box:hover {
  border-color: var(--primary);
}

.photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-box .placeholder {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.upload-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.photo-text-right {
  color: var(--muted);
  font-size: 12px;
  margin-left: 16px;
  line-height: 1.5;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: var(--white);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.upload-trigger:hover {
  background: #132443;
}

input[type="text"],
input[type="date"],
input[type="tel"],
input[type="number"],
textarea,
select {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--white);
  color: var(--text);
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(25, 47, 89, 0.15);
}

textarea {
  min-height: 120px;
}

/* Стили для select элемента */
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

select:hover {
  border-color: var(--primary);
}

select option {
  padding: 8px;
  background: var(--white);
  color: var(--text);
}

select option:disabled {
  color: var(--muted);
  font-style: italic;
  background: #f9fafb;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

button {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.02s ease-in-out, background 0.2s, box-shadow 0.2s;
}

.btn-submit {
  background: var(--primary) !important;
  color: var(--white) !important;
  padding: 12px 20px !important;
  font-weight: 600 !important;
  border: none !important;
}

.btn-submit:hover {
  background: #132443 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

.btn-reset {
  background: #e5e7eb;
  color: #111827;
  padding: 8px 12px;
}

.btn-reset:hover {
  background: #d1d5db;
}

button:active {
  transform: translateY(1px);
}

.button-secondary {
  background: var(--accent);
}

.button-secondary:hover {
  background: #b72828;
}

.required {
  color: var(--accent);
  font-weight: 600;
}

/* Красивая валидация полей */
.field {
  position: relative;
}

.field.error input,
.field.error select,
.field.error textarea {
  border-color: var(--accent) !important;
  background-color: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(221, 51, 51, 0.1) !important;
}

.field.success input,
.field.success select,
.field.success textarea {
  border-color: #059669 !important;
  background-color: #f0f9ff !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1) !important;
}

.field.error .photo-box {
  border-color: var(--accent) !important;
  background-color: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(221, 51, 51, 0.1) !important;
}

.field.success .photo-box {
  border-color: #059669 !important;
  background-color: #f0f9ff !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1) !important;
}

/* Сообщения об ошибках */
.field-error {
  color: var(--accent);
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(-5px);
  transition: all 0.3s ease;
}

.field-error.show {
  opacity: 1;
  transform: translateY(0);
}

.field-error::before {
  content: "⚠";
  font-size: 14px;
}

/* Сообщения об успехе */
.field-success {
  color: #059669;
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(-5px);
  transition: all 0.3s ease;
}

.field-success.show {
  opacity: 1;
  transform: translateY(0);
}

.field-success::before {
  content: "✓";
  font-size: 14px;
  font-weight: bold;
}

/* Анимация для обязательных полей */
.required {
  color: var(--accent);
  font-weight: 600;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* Стили для фокуса */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(25, 47, 89, 0.15) !important;
}

/* Стили для фото при валидации */
.photo-upload.error .photo-box {
  border: 2px dashed var(--accent) !important;
  background-color: #fef2f2 !important;
}

.photo-upload.success .photo-box {
  border: 2px dashed #059669 !important;
  background-color: #f0f9ff !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
  body {
    margin: 0;
    padding: 12px;
  }

  .container {
    margin: 12px 0;
    padding: 16px;
  }

  .site-header .brand {
    font-size: 16px;
    gap: 8px;
  }

  .site-header .brand a {
    padding: 6px 10px;
  }

  .site-header .brand a:hover {
    transform: translateY(-1px);
  }

  .brand-logo {
    width: 20px;
    height: 20px;
  }

  form {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .photo-upload {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .photo-box {
    width: 150px;
    height: 150px;
  }

  .photo-text-right {
    margin-left: 0;
    margin-top: 8px;
    text-align: center;
  }

  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  input[type="text"],
  input[type="date"],
  input[type="tel"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px;
    /* Prevents zoom on iOS */
  }

  /* Work history mobile styles */
  .work-years-row {
    flex-direction: column !important;
    gap: 8px !important;
  }

  /* Stack title and counter on mobile */
  .title-row {
    display: block !important;
  }

  .title-row .counter {
    display: inline-block;
    margin-top: 8px;
  }

  .title-actions {
    display: block !important;
  }

  .title-actions .export-btn {
    display: inline-block;
    margin-top: 8px;
  }

  .work-years-row>div {
    width: 100% !important;
    min-width: unset !important;
  }

  .remove-button-container {
    display: flex !important;
    justify-content: flex-end !important;
    margin-top: 8px !important;
  }

  .remove-work {
    width: 10% !important;
  }

  .work-entry input[style*="width: 98%"] {
    width: 96% !important;
  }

  #add_work {
    width: 60% !important;
    text-align: center !important;
  }

  #add_work:disabled {
    background: #d1d5db !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
  }

  #add_work:not(:disabled) {
    background: #059669 !important;
    color: white !important;
    cursor: pointer !important;
  }
}

@media (max-width: 480px) {
  .site-header .brand {
    font-size: 14px;
  }

  .site-header .brand a {
    padding: 4px 8px;
  }

  .brand-logo {
    width: 18px;
    height: 18px;
  }

  h1 {
    font-size: 20px;
  }

  .photo-box {
    width: 120px;
    height: 120px;
  }

  .upload-icon {
    font-size: 24px;
  }

  /* Extra small screens work history */
  .work-entry {
    padding: 8px !important;
  }

  .work-years-row {
    gap: 6px !important;
  }

  .work-entry label {
    font-size: 11px !important;
  }

  .work-entry input,
  .work-entry select {
    padding: 6px !important;
    font-size: 14px !important;
  }

  /* Адаптивный футер */
  .site-footer {
    padding: 16px 0;
    margin-top: 32px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 0 16px;
  }

  .footer-left {
    justify-content: center;
  }

  .footer-right {
    justify-content: center;
  }

  .footer-text {
    font-size: 15px;
  }

  .footer-right p {
    font-size: 13px;
  }
}

/* Admin Panel Styles */
.header {
  background: var(--primary);
  color: var(--white);
  padding: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content {
  max-width: 96rem;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Admin Panel Footer */
.site-footer .footer-content {
  max-width:80rem;
}

.wrap {
  max-width: 96rem;
  margin: 24px auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
  padding: 20px;
}

.wrap h1 {
  margin: 0;
  font-size: 20px;
}

.wrap h2 {
  margin-top: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  max-height: 80px;
  white-space: nowrap;
}

th {
  background: #f3f4f6;
  color: #374151;
  position: sticky;
  top: 0;
}

.actions a,
.actions button {
  color: var(--white);
  background: var(--accent);
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}

.thumb {
  width: 45px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .2s, box-shadow .2s, transform .02s;
}

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

.btn:active {
  transform: translateY(1px);
}

.btn-logout {
  background: #dd3333;
  color: #fff;
  border-color: #c42d2d;
}

.btn-logout:hover {
  background: #c42d2d;
}

.small {
  color: var(--muted);
  font-size: 12px;
}

.scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

/* Compact scroll area (e.g., admin panel tables) */
.scroll--80 {
  max-height: 80px;
}

.export-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.export-btn {
  display: inline-block;
  background: #192f59;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
}

/* Modal стили */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  position: relative;
  margin: auto;
  padding: 0;
  width: 90%;
  max-width: 800px;
  top: 50%;
  transform: translateY(-50%);
  animation: zoomIn 0.3s ease;
}

.modal-content img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.close {
  position: absolute;
  top: -40px;
  right: 0;
  color: #fff;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  background: rgba(0, 0, 0, 0.5);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.close:hover {
  background: rgba(0, 0, 0, 0.8);
}

.clickable-image {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clickable-image:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: translateY(-50%) scale(0.8);
  }

  to {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

/* Адаптивность для модального окна */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 20px auto;
  }

  .close {
    top: -35px;
    font-size: 24px;
    width: 35px;
    height: 35px;
  }
}
input[type="text"]::placeholder, input[type="date"]::placeholder, input[type="tel"]::placeholder, input[type="number"]::placeholder, textarea::placeholder {
    color: #b1b1b1 !important;
}