/* public/assets/css/style.css */
/* PDPA-Next / DPO Platform - Frontend MVP Base Styles */

:root {
  --color-primary: #1d5b9d;
  --color-primary-dark: #153d6b;
  --color-bg: #f8fafc;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-border: #e2e8f0;
  --sidebar-width: 16rem;
  --sidebar-width-collapsed: 5rem;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  font-family: "Sarabun", "Kanit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-kanit {
  font-family: "Kanit", "Sarabun", sans-serif;
}

button,
nav,
.app-header,
.sidebar-btn {
  user-select: none;
  -webkit-user-select: none;
}

button {
  cursor: pointer;
}

button:disabled,
button[disabled] {
  cursor: not-allowed;
}

input,
textarea,
select {
  font-family: "Sarabun", "Kanit", sans-serif;
}

.overflow-y-auto,
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}

*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(29, 91, 157, 0.25);
}

/* -------------------------------------------------------------------------- */
/* Scrollbars */
/* -------------------------------------------------------------------------- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* -------------------------------------------------------------------------- */
/* Animation Utilities */
/* -------------------------------------------------------------------------- */

.fade-in {
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

.slide-in-left {
  animation: slideInLeft 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

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

@keyframes skeletonShimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.skeleton-box {
  display: inline-block;
  height: 1em;
  position: relative;
  overflow: hidden;
  background-color: #e2e8f0;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0.65) 20%,
    rgba(255, 255, 255, 0) 60%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: skeletonShimmer 1.5s infinite ease-in-out;
  border-radius: 0.375rem;
}

/* -------------------------------------------------------------------------- */
/* Auth Guard */
/* -------------------------------------------------------------------------- */

.auth-locked {
  display: none !important;
  opacity: 0 !important;
}

/* -------------------------------------------------------------------------- */
/* Sidebar */
/* -------------------------------------------------------------------------- */

#main-sidebar {
  width: var(--sidebar-width);
}

#main-sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

#main-sidebar.collapsed .sidebar-text,
#main-sidebar.collapsed .sidebar-chevron,
#main-sidebar.collapsed .sidebar-submenu {
  display: none !important;
}

#main-sidebar.collapsed .sidebar-btn {
  justify-content: center !important;
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}

#main-sidebar.collapsed .sidebar-btn-inner {
  margin-right: 0 !important;
}

#main-sidebar.collapsed .sidebar-footer-box {
  justify-content: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

.sidebar-btn {
  min-height: 2.5rem;
}

.sidebar-submenu button {
  min-height: 2.25rem;
}

/* -------------------------------------------------------------------------- */
/* Surface / Card Helpers */
/* -------------------------------------------------------------------------- */

.bg-surface {
  background-color: #ffffff;
}

.card-soft {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card-soft:hover {
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.glass-white {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.glass-dark {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* -------------------------------------------------------------------------- */
/* Form Helpers for ROPA Pages */
/* -------------------------------------------------------------------------- */

.form-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.form-section-title {
  font-family: "Kanit", "Sarabun", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.35rem;
}

.field-hint {
  display: block;
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.input-base,
.select-base,
.textarea-base {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.875rem;
  padding: 0.65rem 0.8rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.input-base:focus,
.select-base:focus,
.textarea-base:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(29, 91, 157, 0.12);
}

.textarea-base {
  resize: vertical;
  min-height: 5.5rem;
}

.input-base[disabled],
.select-base[disabled],
.textarea-base[disabled] {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* -------------------------------------------------------------------------- */
/* Badges */
/* -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 9999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-draft {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.badge-submitted {
  color: #047857;
  background: #d1fae5;
  border-color: #a7f3d0;
}

.badge-pending {
  color: #b45309;
  background: #fef3c7;
  border-color: #fde68a;
}

.badge-danger {
  color: #be123c;
  background: #ffe4e6;
  border-color: #fecdd3;
}

.badge-info {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #bfdbfe;
}

/* -------------------------------------------------------------------------- */
/* Table Helpers */
/* -------------------------------------------------------------------------- */

.table-clean {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.table-clean th {
  background: #f1f5f9;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
  padding: 0.8rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.table-clean td {
  padding: 0.8rem;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
}

.table-clean tbody tr:hover {
  background: #f8fafc;
}

/* -------------------------------------------------------------------------- */
/* SweetAlert Polishing */
/* -------------------------------------------------------------------------- */

.swal2-popup {
  font-family: "Sarabun", "Kanit", sans-serif !important;
  border-radius: 1rem !important;
}

.swal2-title {
  font-family: "Kanit", "Sarabun", sans-serif !important;
}

/* -------------------------------------------------------------------------- */
/* Mobile Tweaks */
/* -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  body {
    overflow: hidden;
  }

  #main-workspace {
    width: 100%;
  }

  #main-sidebar {
    width: 17rem;
  }

  .form-section {
    padding: 0.875rem;
  }
}

/* -------------------------------------------------------------------------- */
/* Reduced Motion */
/* -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
