/* ============================================
   FreelancePH Tools — Premium Design System 2026
   ============================================ */

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

/* ---- CSS Variables ---- */
:root {
  /* Brand */
  --color-primary: #3b82f6;
  --color-primary-dark: #2563eb;
  --color-primary-light: rgba(59,130,246,0.1);
  --color-secondary: #059669;
  --color-secondary-dark: #047857;
  --color-secondary-light: #ecfdf5;
  --color-accent: #8b5cf6;
  --color-accent-light: rgba(139,92,246,0.1);
  --color-danger: #ef4444;
  --color-warning: #f59e0b;

  /* Text */
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;

  /* Backgrounds */
  --color-bg: #ffffff;
  --color-bg-alt: #f8fafc;
  --color-bg-section: #f1f5f9;
  --color-border: #e2e8f0;
  --color-border-focus: #3b82f6;

  /* PH Colors (subtle accent) */
  --color-ph-blue: #0038a8;
  --color-ph-red: #ce1126;

  /* Dark Hero Palette */
  --dark-base: #0a0a1a;
  --dark-surface: rgba(255,255,255,0.04);
  --dark-border: rgba(255,255,255,0.08);
  --dark-text: #f1f5f9;
  --dark-text-muted: rgba(241,245,249,0.65);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.18);
  --shadow-glow-blue: 0 0 24px rgba(59,130,246,0.35);
  --shadow-glow-purple: 0 0 24px rgba(139,92,246,0.35);

  /* Layout */
  --max-width: 1200px;
  --header-height: 68px;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-weight: 400;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-text);
}

h1 { font-size: clamp(1.75rem, 5vw, 2.75rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 3.5vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.35rem); }
h4 { font-size: 1.05rem; }

p { margin-bottom: 1rem; font-weight: 300; }
p:last-child { margin-bottom: 0; }

.text-muted { color: var(--color-text-muted); }
.text-small { font-size: 0.875rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-danger { color: var(--color-danger); }

/* ---- Keyframe Animations ---- */
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 16px rgba(59,130,246,0.4); }
  50% { box-shadow: 0 0 32px rgba(139,92,246,0.6), 0 0 48px rgba(59,130,246,0.3); }
}

@keyframes float-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes mesh-move {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.97); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes badge-pop {
  0% { opacity: 0; transform: scale(0.8) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Grain / Noise Texture (hero overlay) ---- */
.grain-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  z-index: 1;
}

/* ---- Layout ---- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container { padding: 0 1.5rem; }
}

@media (min-width: 1024px) {
  .container { padding: 0 2rem; }
}

.section { padding: 3rem 0; }
.section-lg { padding: 5rem 0; }

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(1, 1fr); }
.grid-3 { grid-template-columns: repeat(1, 1fr); }
.grid-4 { grid-template-columns: repeat(1, 1fr); }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }

/* ---- Cards (base, used by inner tool pages) ---- */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-smooth), transform var(--transition-smooth);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-flat {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card-highlight { border-left: 4px solid var(--color-primary); }

.card-success {
  background: var(--color-secondary-light);
  border-color: var(--color-secondary);
}

/* ---- Glassmorphism Cards ---- */
.glass-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-family);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-smooth);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(59,130,246,0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, #7c3aed 100%);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59,130,246,0.32);
}

.btn-secondary {
  background: var(--color-secondary);
  color: #fff;
}
.btn-secondary:hover:not(:disabled) {
  background: var(--color-secondary-dark);
  color: #fff;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.3);
  color: #fff;
  backdrop-filter: blur(8px);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.6);
  color: #fff;
  text-decoration: none;
}

/* Light context outline button */
.btn-outline-dark {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-outline-dark:hover:not(:disabled) {
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-section);
  color: var(--color-text);
  text-decoration: none;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1.0625rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }

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

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.375rem;
}

.form-label-hint {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.5;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

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

.form-input-prefix { position: relative; }

.form-input-prefix .prefix {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-weight: 600;
  pointer-events: none;
}

.form-input-prefix input { padding-left: 2rem; }

.form-hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.form-error {
  font-size: 0.8125rem;
  color: var(--color-danger);
  margin-top: 0.25rem;
}

.form-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .form-row.cols-2 { grid-template-columns: 1fr 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---- Result / Output Boxes ---- */
.result-box {
  background: var(--color-bg-alt);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.result-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.result-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 20px;
  line-height: 1.4;
}

.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-success { background: var(--color-secondary-light); color: var(--color-secondary-dark); }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ---- Divider ---- */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

/* ---- Alert / Notice ---- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border-left: 4px solid;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-info { background: var(--color-primary-light); border-color: var(--color-primary); color: #1e3a8a; }
.alert-success { background: var(--color-secondary-light); border-color: var(--color-secondary); color: #064e3b; }
.alert-warning { background: #fffbeb; border-color: var(--color-warning); color: #78350f; }
.alert-danger { background: #fef2f2; border-color: var(--color-danger); color: #7f1d1d; }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; }

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

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  background: var(--color-bg-section);
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

tr:hover td { background: var(--color-bg-alt); }

/* ---- Frosted Glass Header / Nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  height: var(--header-height);
  box-shadow: 0 1px 24px rgba(0, 0, 0, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.site-logo {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
  transition: all var(--transition-smooth);
}

.site-logo:hover {
  text-decoration: none;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-nav {
  display: none;
  align-items: center;
  gap: 0.2rem;
}

@media (min-width: 768px) {
  .site-nav { display: flex; }
}

.site-nav a {
  padding: 0.35rem 0.7rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius-pill);
  transition: all var(--transition-smooth);
}

.site-nav a:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--color-primary);
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(139,92,246,0.12));
  font-weight: 600;
}

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
}

@media (min-width: 768px) {
  .hamburger { display: none; }
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* Mobile nav — glass panel */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 26, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
}

.mobile-nav.open { display: block; }

.mobile-nav-panel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

.mobile-nav-panel a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text);
  border-radius: var(--radius-md);
  transition: all var(--transition-smooth);
}

.mobile-nav-panel a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  text-decoration: none;
}

/* ---- Footer ---- */
.site-footer {
  background: var(--color-bg-section);
  border-top: 1px solid var(--color-border);
  padding: 2.5rem 0 2rem;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-brand { font-size: 0.9rem; color: var(--color-text-muted); }
.footer-brand strong { color: var(--color-text); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.footer-links a:hover { color: var(--color-primary); }

.footer-donate { margin-top: 0.5rem; }

/* ---- Page Hero (inner pages) ---- */
.page-hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.page-hero h1 { margin-bottom: 0.5rem; }
.page-hero p { color: var(--color-text-muted); font-size: 1.05rem; margin-bottom: 0; }

/* ---- Tab Switcher ---- */
.tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--color-bg-section);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  width: fit-content;
}

.tab-btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-family);
}

.tab-btn:hover { color: var(--color-text); }

.tab-btn.active {
  background: var(--color-bg);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Gradient Text Utility ---- */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradient-shift 4s ease infinite;
}

/* ---- Gradient Border Card (subtle hover lift, no spin) ---- */
.gradient-border {
  position: relative;
  border-radius: var(--radius-xl);
  transition: box-shadow var(--transition-smooth), transform var(--transition-smooth);
}

.gradient-border:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ---- Utilities ---- */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.p-0 { padding: 0; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ---- Print ---- */
@media print {
  .site-header,
  .site-footer,
  .no-print,
  .btn,
  .hamburger,
  .mobile-nav { display: none !important; }

  body { background: white; color: black; }

  .card, .card-flat {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
