/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-hover: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent-blue: #3b82f6;
  --accent-blue-light: #eff6ff;
  --accent-green: #10b981;
  --accent-green-light: #ecfdf5;
  --accent-orange: #f97316;
  --accent-orange-light: #fff7ed;
  --accent-purple: #8b5cf6;
  --accent-purple-light: #f5f3ff;
  
  --border-color: #e2e8f0;
  --border-focus: #cbd5e1;
  
  --font-display: 'Outfit', 'Sarabun', sans-serif;
  --font-body: 'Inter', 'Sarabun', sans-serif;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: 3rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
}

/* Premium Light Theme Glassmorphism */
.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  transition: transform 0.2s, box-shadow 0.2s;
}

.glass-panel:hover {
  box-shadow: var(--shadow-lg);
}

/* App Header */
.app-header {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  padding: 2.5rem 2rem;
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.app-header::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background-color: var(--accent-blue);
  color: white;
}
.btn-primary:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background-color: var(--bg-hover);
  transform: translateY(-1px);
}

.btn-success {
  background-color: var(--accent-green);
  color: white;
}
.btn-success:hover {
  background-color: #059669;
  transform: translateY(-1px);
}

.btn-warning {
  background-color: var(--accent-orange);
  color: white;
}
.btn-warning:hover {
  background-color: #ea580c;
  transform: translateY(-1px);
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg-secondary);
  transition: all 0.2s ease;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-blue);
  background-color: var(--accent-blue-light);
}

/* Styled Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.mineral-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.mineral-table th {
  background-color: var(--bg-hover);
  color: var(--text-secondary);
  padding: 0.875rem 1rem;
  font-family: var(--font-display);
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.mineral-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  white-space: nowrap;
}

.mineral-table tr:hover {
  background-color: rgba(241, 245, 249, 0.5);
}

/* Badge colors */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
}
.badge-blue { background-color: var(--accent-blue-light); color: var(--accent-blue); }
.badge-green { background-color: var(--accent-green-light); color: var(--accent-green); }
.badge-orange { background-color: var(--accent-orange-light); color: var(--accent-orange); }
.badge-purple { background-color: var(--accent-purple-light); color: var(--accent-purple); }

/* Custom Checkbox Grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
}

.checkbox-item:hover {
  background-color: var(--bg-hover);
}

.checkbox-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Tooltip & Micro interactions */
.tooltip {
  position: relative;
}
.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.25rem 0.5rem;
  background-color: var(--text-primary);
  color: white;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

/* Report Documents (Preview & PDF) */
.report-document {
  background: #ffffff;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  color: var(--text-primary);
}

.report-header {
  border-bottom: 3px solid var(--accent-blue);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.report-logo-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.report-logo {
  font-size: 2rem;
  color: var(--accent-blue);
}

.report-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.report-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.report-meta-line strong {
  color: var(--text-primary);
}

.report-section {
  margin-bottom: 1.75rem;
  page-break-inside: avoid;
}

.report-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border-left: 4px solid var(--accent-blue);
  padding: 0.625rem 0.875rem;
  margin-bottom: 0.75rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.report-section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: #1d4ed8;
  margin: 0;
}

.report-section-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.report-stat {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: white;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
}

.report-stat strong {
  color: var(--text-primary);
  margin-right: 0.25rem;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
}

.report-table th {
  background: #1e40af;
  color: white;
  padding: 0.45rem 0.5rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.report-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.report-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.report-table tbody tr:hover {
  background: #eff6ff;
}

.report-mineral-block {
  margin-bottom: 2rem;
  page-break-inside: avoid;
}

.report-mineral-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  background: #dbeafe;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

#pdf-export-wrapper {
  font-family: var(--font-body);
}
