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

:root {
  --primary: #1a365d;
  --primary-light: #2c5282;
  --accent: #c9a227;
  --bg: #f7f5f0;
  --card-bg: #ffffff;
  --border: #d4cfc4;
  --text: #2d3748;
  --text-muted: #718096;
  --error: #c53030;
  --success: #276749;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --font: 'Segoe UI', Tahoma, Arial, sans-serif;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== Page Layout ===== */
.page {
  min-height: 100vh;
  padding-bottom: 3rem;
}

.header {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-bottom: 4px solid var(--accent);
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.subtitle {
  font-size: 1rem;
  opacity: 0.85;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.dashboard-page .container {
  max-width: 960px;
}

/* ===== Form Card ===== */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 1.75rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--primary);
  font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="tel"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
  background: #fff;
}

.form-group input.error {
  border-color: var(--error);
}

.hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.error-msg {
  display: block;
  font-size: 0.82rem;
  color: var(--error);
  margin-top: 0.35rem;
  min-height: 1.2em;
}

/* ===== Phone Input ===== */
.phone-input-wrapper {
  display: flex;
  flex-direction: row;
  direction: ltr;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fafafa;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.phone-input-wrapper:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
  background: #fff;
}

.phone-input-wrapper.error {
  border-color: var(--error);
}

.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  border-right: 1px solid var(--border);
}

.phone-input-wrapper input {
  flex: 1;
  border: none;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: var(--font);
  background: transparent;
  direction: ltr;
  text-align: left;
}

.phone-input-wrapper input:focus {
  outline: none;
  box-shadow: none;
}

/* ===== Upload Zone ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #fafafa;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-light);
  background: rgba(44, 82, 130, 0.04);
}

.upload-zone.error {
  border-color: var(--error);
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--primary-light);
  margin-bottom: 0.75rem;
}

.upload-text {
  font-size: 0.95rem;
  color: var(--text);
}

.upload-text span {
  color: var(--primary-light);
  font-weight: 600;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ===== File Preview List ===== */
.preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.preview-item {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #eee;
}

.preview-item img,
.preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item .file-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 4px;
  text-align: center;
}

.preview-item .remove-btn {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-item .remove-btn:hover {
  background: #9b2c2c;
}

/* ===== Submit Button ===== */
.btn-submit {
  display: block;
  width: 100%;
  padding: 0.9rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  position: relative;
}

.btn-submit:hover {
  background: var(--primary-light);
}

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

.btn-submit:disabled {
  opacity: 0.7;
}

.footer-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--success);
  color: #fff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 1000;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.error {
  background: var(--error);
}

/* ===== Dashboard ===== */
.dashboard-header {
  text-align: right;
}

.header-row {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn-back {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 1px solid rgba(255,255,255,0.3);
  transition: background 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-back:hover {
  background: rgba(255,255,255,0.25);
  text-decoration: none;
}

.stats-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
  min-width: 140px;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--border);
  margin-bottom: 1rem;
}

.empty-state h2 {
  font-size: 1.3rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.empty-state .btn-submit {
  display: inline-block;
  width: auto;
  padding: 0.75rem 2rem;
}

/* ===== Submission Cards ===== */
.submissions-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.submission-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  background: var(--primary);
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-date {
  font-size: 0.8rem;
  opacity: 0.8;
}

.card-body {
  padding: 1.25rem;
}

.info-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #eee;
}

.info-row:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.info-label {
  font-weight: 600;
  color: var(--primary);
  min-width: 90px;
  font-size: 0.9rem;
}

.info-value {
  color: var(--text);
  font-size: 0.95rem;
}

.info-value.phone {
  direction: ltr;
  text-align: right;
}

/* ===== Media Gallery ===== */
.media-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.media-section h4 {
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.media-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  background: #eee;
  transition: transform 0.2s, box-shadow 0.2s;
}

.media-thumb:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow);
}

.media-thumb img,
.media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-thumb .type-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.media-thumb .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: rgba(0,0,0,0.55);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  pointer-events: none;
}

.card-actions {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
}

.btn-delete {
  padding: 0.4rem 1rem;
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-delete:hover {
  background: var(--error);
  color: #fff;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  z-index: 1;
  padding: 1rem;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(0,0,0,0.75);
}

.modal-body img,
.modal-body video {
  max-width: 80vw;
  max-height: 80vh;
  display: block;
  border-radius: 4px;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .header h1 {
    font-size: 1.5rem;
  }

  .form-card {
    padding: 1.25rem;
  }

  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .media-gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
