/* ===== Google Font ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1a2744;
  --accent: #00d4ff;
  --accent-secondary: #7b2ff7;
  --accent-gradient: linear-gradient(135deg, #00d4ff, #7b2ff7);
  --text-primary: #e8e8f0;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(0, 212, 255, 0.3);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===== Body ===== */
body {
  font-family: 'Noto Sans Thai', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  position: relative;
  overflow-x: hidden;
}

/* Animated background blobs */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  z-index: 0;
  pointer-events: none;
}

body::before {
  width: 600px;
  height: 600px;
  background: var(--accent);
  top: -200px;
  right: -100px;
  animation: float 20s ease-in-out infinite;
}

body::after {
  width: 500px;
  height: 500px;
  background: var(--accent-secondary);
  bottom: -100px;
  left: -100px;
  animation: float 25s ease-in-out infinite reverse;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  25% {
    transform: translate(50px, -30px) scale(1.05);
  }

  50% {
    transform: translate(-20px, 40px) scale(0.95);
  }

  75% {
    transform: translate(30px, 20px) scale(1.02);
  }
}

/* ===== Header ===== */
.header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}

.header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.header p {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 300;
}

.header .badge {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent);
  border: 1px solid var(--border-accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ===== Card ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

.card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card h2 .icon {
  font-size: 1.4rem;
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

/* ===== Upload Area ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.03);
}

.upload-area .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
  transition: var(--transition);
}

.upload-area:hover .upload-icon {
  transform: scale(1.1) translateY(-2px);
}

.upload-area .upload-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.upload-area .upload-text strong {
  color: var(--accent);
}

.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ===== Preview ===== */
.preview-container {
  margin-top: 1rem;
  display: none;
  animation: fadeIn 0.4s ease;
  text-align: center;
}

.preview-container.show {
  display: block;
}

.preview-container img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
  display: block;
  margin: 0 auto;
}

.file-info {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 212, 255, 0.05);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-accent);
}

.file-info .filename {
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== Submit Button ===== */
.btn-submit {
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent-gradient);
  cursor: pointer;
  transition: var(--transition);
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
}

.btn-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent 60%);
  opacity: 0;
  transition: var(--transition);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.3);
}

.btn-submit:hover::after {
  opacity: 1;
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ===== Result ===== */
.result {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  display: none;
  animation: slideUp 0.4s ease;
}

.result.show {
  display: block;
}

.result.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.result.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.result .result-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result .result-link {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.result .result-link:hover {
  background: rgba(0, 212, 255, 0.2);
  transform: translateY(-1px);
}

/* ===== Uploaded Files Section ===== */
.files-section {
  width: 100%;
  max-width: 520px;
  margin-top: 2rem;
  position: relative;
  z-index: 1;
}

.files-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.file-item:hover {
  border-color: var(--border-accent);
}

.file-item a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.file-item a:hover {
  text-decoration: underline;
}

.file-item .ext-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
}

.ext-badge.safe {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.ext-badge.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* ===== Files Header ===== */
.files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.files-header h3 {
  margin-bottom: 0;
}

/* ===== File Item Actions ===== */
.file-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== Deface Button ===== */
.btn-deface {
  padding: 0.3rem 0.65rem;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-deface:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
  transform: translateY(-1px);
}

.btn-deface:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* ===== Reset Button ===== */
.btn-reset {
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-reset:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.6);
  transform: translateY(-1px);
}

/* ===== Footer ===== */
.footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Spinner ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Responsive ===== */
@media (max-width: 560px) {
  .card {
    padding: 1.75rem;
  }

  .header h1 {
    font-size: 1.6rem;
  }
}

/* ===== Utilities ===== */

.d-none {
  display: none !important;
}

/* ===== Profile Card ===== */
.profile-card {
  display: none;
  /* Hidden by default */
  text-align: center;
  margin-top: 2rem;
  padding: 2rem;
  border: 2px dashed #4caf50;
  border-radius: 10px;
}

.profile-card.active {
  display: block;
  /* Show when active */
  animation: fadeIn 0.5s ease;
}

.profile-card h2 {
  justify-content: center;
  color: #4caf50;
  margin-bottom: 1rem;
}

.profile-card img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin: 1rem 0;
}