/* =========================
   YTAC Shared UI (ui.css)
   Final revised (width-locked)
   ========================= */

/* Base */
:root{
  --bg: #f4f6f7;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;

  --border: #d0d0d0;
  --tab-inactive: #e5e7eb;
  --tab-hover: #dbeafe;
  --tab-active: #2563eb;
  --tab-active-border: #1e40af;

  --btn-green: #1e8449;
  --btn-blue:  #1f4fd8;
  --btn-red:   #922b21;
  --btn-gray:  #34495e;

  --focus: #ffd54f;

  /* Themeable blocks (light defaults) */
  --hint-color: #777;
  --preview-bg: #000;

  --result-bg: #f1f1f1;
  --result-text: inherit;

  --box-bg: #ffffff;
  --box-text: #444;
  --box-border: 1px solid #ddd;

  --pill-bg: #eef;
  --pill-text: inherit;

  /* IntelliGreen header tokens (LOCKED THEME) */
  --ig-header-bg: rgba(0,0,0,0.62);
  --ig-header-border: rgba(174,255,176,0.18);
  --ig-header-shadow: 0 0 6px rgba(0,0,0,0.25);

  --ig-back-bg: #2f7f33;
  --ig-back-hover: #64C367;
  --ig-back-text: #ffffff;
}

/* ✅ Global box sizing (prevents 100%+padding overflow) */
*{ box-sizing: border-box; }

/* ✅ Extra safety: force all content inside card to respect width */
.card,
.card *{
  box-sizing: border-box;
  max-width: 100%;
}

body{
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  color: var(--text);

  background:
    radial-gradient(circle at top left, #f4f8f4 0%, transparent 45%),
    radial-gradient(circle at bottom right, #e6efe6 0%, transparent 45%),
    linear-gradient(180deg, #eef3ee 0%, #f8fbf8 100%);
  background-attachment: fixed;
}

/* Optional helper: use this wrapper to keep spacing consistent */
.section{
  width: 100%;
  max-width: 100%;
  margin-bottom: 14px;
}

/* Content card */
.card{
  max-width: 760px;
  margin: auto;
  background: var(--card);
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.10);
}

h2{ text-align: center; margin: 0 0 6px; }
p{ text-align: center; color: var(--muted); margin: 0 0 14px; }

/* Tabs */
.tabs{
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}
.tab{
  flex: 1;
  min-width: 160px;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--tab-inactive);
  cursor: pointer;
  font-weight: 700;
  color: #1f2937;
}
.tab:hover{ background: var(--tab-hover); }
.tab.active{
  background: var(--tab-active) !important;
  border-color: var(--tab-active-border) !important;
  color: #ffffff !important;
}

/* Inputs */
input[type="file"]{ width: 100%; margin: 10px 0 10px; max-width: 100%; }
input[type="text"],
input[type="search"],
textarea,
select{
  width: 100%;
  max-width: 100%;
}

.hint{
  font-size: 12px;
  color: var(--hint-color);
  margin-top: 6px;
}

/* Buttons */
button{
  width: 100%;
  max-width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: .4px;
}
button:disabled{
  background: #9ca3af !important;
  cursor: not-allowed;
}
button:hover:not(:disabled){ filter: brightness(1.08); }
button:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.btn-green{ background: var(--btn-green); }
.btn-blue { background: var(--btn-blue); }
.btn-red  { background: var(--btn-red); }
.btn-gray { background: var(--btn-gray); }

/* Layout */
.row{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}
.row > *{ flex: 1; min-width: 0; } /* ✅ prevents flex children overflow */

/* Preview */
.preview{
  margin-top: 12px;
  display: none;
  width: 100%;
  max-width: 100%;
}
.preview img,
.preview video{
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  background: var(--preview-bg);
}

/* Result blocks */
.result{
  margin-top: 16px;
  padding: 15px;
  background: var(--result-bg);
  color: var(--result-text);
  border-radius: 10px;
  display: none;
  width: 100%;
  max-width: 100%;
}
.box{
  margin-top: 10px;
  padding: 10px;
  background: var(--box-bg);
  border: var(--box-border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--box-text);
  line-height: 1.35;
  width: 100%;
  max-width: 100%;
}
.label{ font-weight: 800; }

.pill{
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-text);
  font-size: 12px;
  margin-left: 6px;
  max-width: 100%;
}

/* =====================================================
   ✅ Hazard Dark Theme (FORCE VISIBILITY)
   Apply by: <body class="theme-hazard">
   ===================================================== */
.theme-hazard{
  --hint-color: rgba(234,255,234,0.92);

  --result-bg: rgba(0,0,0,0.24);
  --result-text: #ffffff;

  --box-bg: rgba(0,0,0,0.28);
  --box-text: #ffffff;
  --box-border: 1px solid rgba(174,255,176,0.28);

  --pill-bg: rgba(0,0,0,0.28);
  --pill-text: #ffffff;

  --preview-bg: rgba(0,0,0,0.35);
}

/* 🔥 Force override any old light styles from legacy modules */
.theme-hazard .result{
  background: rgba(0,0,0,0.24) !important;
  color: #ffffff !important;
}
.theme-hazard .box{
  background: rgba(0,0,0,0.28) !important;
  color: #ffffff !important;
  border: 1px solid rgba(174,255,176,0.28) !important;
}
.theme-hazard .box *{
  color: #ffffff !important;
}
.theme-hazard .box .label,
.theme-hazard .box strong{
  color: #ffffff !important;
}
.theme-hazard .box small,
.theme-hazard .box .muted,
.theme-hazard .hint{
  color: rgba(234,255,234,0.95) !important;
}

/* If you use small "chips/badges" inside boxes */
.theme-hazard .badge,
.theme-hazard .chip,
.theme-hazard .tag{
  background: rgba(0,0,0,0.28) !important;
  border: 1px solid rgba(174,255,176,0.28) !important;
  color: #ffffff !important;
}

/* =====================================================
   INTELLIGREEN GLOBAL HEADER (LOCKED: DARK GLASS)
   ===================================================== */
.ig-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 14px 22px;
  margin-bottom: 18px;
  border-radius: 16px;

  /* 🔒 Dark header */
  background: var(--ig-header-bg);
  border: 1px solid var(--ig-header-border);
  box-shadow: var(--ig-header-shadow);

  position: relative;
  z-index: 9999;
  backdrop-filter: blur(6px);
}

.ig-brand{
  display: flex;
  align-items: center;
  gap: 12px;
}

.ig-brand a{
  display:flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
}

.ig-brand img{ width: 44px; height: auto; }

.ig-title{
  font-size: 22px;
  font-weight: 900;
  color: rgba(255,255,255,0.92);
  letter-spacing: 0.4px;
}

/* Optional nav (if some pages still use it) */
.ig-nav{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ig-nav a{
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 13px;
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(174,255,176,0.18);
  transition: 0.2s ease;
  white-space: nowrap;
}
.ig-nav a:hover{
  background: rgba(255,255,255,0.18);
}

/* Single Back button style used by your modules */
.back-button{
  background-color: var(--ig-back-bg);
  border: none;
  color: var(--ig-back-text);
  padding: 12px 22px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  max-width: 100%;
}
.back-button:hover{ background-color: var(--ig-back-hover); }

@media (max-width: 760px){
  .ig-header{ flex-direction: column; align-items: flex-start; }
  .back-button{ width: 100%; }
}

.ig-page{ padding-top: 12px; position: relative; z-index: 1; }

/* Watermark background */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;

  background-image: url("logo (1).png");
  background-repeat: no-repeat;
  background-size: min(900px, 85vw);
  background-position: left 120px top 120px;

  opacity: 0.18;
  filter: drop-shadow(0 14px 30px rgba(0,0,0,0.25));
}

/* ✅ Fix: prevent 100% + border/padding from overflowing the card */
.file-cta,
.file-cta *,
.focus-input,
input[type="text"],
input[type="search"],
textarea,
select,
.tabs,
.tab,
.btn-green,
.btn-blue,
.btn-gray,
.btn-red{
  box-sizing: border-box !important;
  max-width: 100% !important;
}
