/* === Reset & Base (RTL) === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { direction: rtl; font-size: 18px; }

body {
  font-family: "Segoe UI", "Noto Sans Hebrew", "Rubik", Arial, sans-serif;
  line-height: 1.6;
  color: #1a1a1a;
  background: #f7f5f0;
  min-height: 100vh;
}

/* === Layout === */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* === Header === */
header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #d4a574;
}

header h1 {
  font-size: 2rem;
  color: #5c3d2e;
  margin-bottom: 0.25rem;
}

header .subtitle {
  font-size: 1.1rem;
  color: #8b6f5e;
}

/* === Form === */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #3d2b1f;
}

.form-group label .required {
  color: #c0392b;
  margin-right: 0.2rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  border: 1px solid #d0c4b8;
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #8b5e3c;
  box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.15);
}

.form-group input.error,
.form-group textarea.error {
  border-color: #c0392b;
  background: #fef7f7;
}

.form-group .error-message {
  color: #c0392b;
  font-size: 0.85rem;
  margin-top: 0.3rem;
  display: none;
}

.form-group .error-message.visible {
  display: block;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

/* === Authorization Text === */
.authorization-box {
  background: #fdfaf5;
  border: 1px solid #d4a574;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  max-height: 200px;
  overflow-y: auto;
}

.authorization-box h3 {
  font-size: 1.05rem;
  color: #5c3d2e;
  margin-bottom: 0.5rem;
}

.authorization-box .legal-text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #4a3728;
  white-space: pre-line;
}

/* === Checkbox === */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.2rem;
  accent-color: #8b5e3c;
}

.checkbox-group label {
  font-weight: 500;
  cursor: pointer;
}

.checkbox-group.error label {
  color: #c0392b;
}

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 0.7rem 2rem;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: #8b5e3c;
  color: #fff;
  width: 100%;
}

.btn-primary:hover { background: #6d4a2e; }

.btn-secondary {
  background: #e8d5c4;
  color: #5c3d2e;
}

.btn-secondary:hover { background: #d4b896; }

.btn-new {
  background: #fff;
  color: #5c3d2e;
  border: 1px solid #d0c4b8;
}

.btn-new:hover { background: #f5f0eb; }

/* === Messages === */
.message-box {
  text-align: center;
  padding: 2rem 1rem;
}

.message-box .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.message-box h2 {
  font-size: 1.5rem;
  color: #5c3d2e;
  margin-bottom: 0.5rem;
}

.message-box p {
  color: #6b5b4e;
  margin-bottom: 1.5rem;
}

/* === Duplicate Actions === */
.duplicate-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.duplicate-actions .btn { width: auto; }

.existing-data {
  background: #fdfaf5;
  border: 1px solid #d4a574;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  text-align: right;
}

.existing-data h3 {
  font-size: 1rem;
  color: #5c3d2e;
  margin-bottom: 0.5rem;
}

.existing-data dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.9rem;
}

.existing-data dt { font-weight: 600; color: #3d2b1f; }
.existing-data dd { color: #6b5b4e; }

/* === Admin === */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.admin-header .logout {
  font-size: 0.9rem;
  color: #8b6f5e;
  text-decoration: none;
}

.admin-header .logout:hover { color: #c0392b; }

.submissions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.submissions-table th {
  text-align: right;
  background: #5c3d2e;
  color: #fff;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
}

.submissions-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e0d5c8;
}

.submissions-table tr:hover td {
  background: #fdfaf5;
}

.submissions-table .actions {
  white-space: nowrap;
}

.submissions-table .actions a {
  color: #8b5e3c;
  text-decoration: none;
  font-size: 1.1rem;
  margin: 0 0.2rem;
}

.submissions-table .actions a:hover { color: #5c3d2e; }

.admin-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.admin-actions .btn { width: auto; font-size: 0.9rem; }

/* === Login === */
.login-form {
  max-width: 360px;
  margin: 3rem auto;
}

.login-form .btn { width: 100%; }

.login-error {
  color: #c0392b;
  text-align: center;
  margin-bottom: 1rem;
  font-weight: 500;
}

/* === Footer === */
footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e0d5c8;
  color: #a09080;
  font-size: 0.8rem;
}

/* === Responsive === */
@media (max-width: 500px) {
  .container { padding: 1rem; }
  header h1 { font-size: 1.5rem; }
  .duplicate-actions { flex-direction: column; }
  .admin-actions { flex-direction: column; }
  .submissions-table { font-size: 0.8rem; }
  .submissions-table th, .submissions-table td { padding: 0.4rem 0.5rem; }
}