/* /public/assets/app.css */

/* =========================
   Design Tokens (Dark, premium)
   ========================= */
:root{
  --bg: #0b0f14;
  --bg-2: #0f1623;
  --panel: #111827;
  --panel-2: #0b1220;
  --text: #e5e7eb;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --faint: rgba(255,255,255,.08);
  --faint-2: rgba(255,255,255,.12);

  --brand: #e5e7eb;
  --brand-2: #9ca3af;
  --danger: #fca5a5;

  --radius: 14px;
  --radius-sm: 10px;

  --shadow: 0 18px 55px rgba(0,0,0,.45);
  --shadow-soft: 0 10px 30px rgba(0,0,0,.35);

  --container: 1180px;
  --gap: 16px;

  --focus: 0 0 0 3px rgba(229,231,235,.12);
}

/* =========================
   Base
   ========================= */
*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  line-height: 1.45;
}
a{ color: var(--text); text-decoration: none; }
a:hover{ text-decoration: underline; }

img{ max-width:100%; display:block; }

.container{
  width:100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 18px;
}

.hidden{ display:none !important; }

/* =========================
   Buttons / Inputs
   ========================= */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  height:38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--faint);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
  user-select:none;
}
.btn:hover{ border-color: var(--faint-2); background: rgba(255,255,255,.06); }
.btn:focus{ outline:none; box-shadow: var(--focus); }
.btn--primary{
  background: var(--brand);
  color: #0b0f14;
  border-color: rgba(255,255,255,.0);
}
.btn--primary:hover{ background: rgba(229,231,235,.92); }

.input{
  width:100%;
  height:46px;
  padding: 0 44px 0 14px;
  border-radius: 999px;
  border: 1px solid var(--faint);
  background: rgba(255,255,255,.03);
  color: var(--text);
}
.input::placeholder{ color: rgba(203,213,225,.65); }
.input:focus{ outline:none; box-shadow: var(--focus); border-color: var(--faint-2); }

.input[type="search"]{
  padding-right: 44px;
}

.input[type="search"]::-webkit-search-cancel-button{
  margin-right: 18px;
  cursor: pointer;
}

.icon-btn{
  width:38px;
  height:38px;
  border-radius: 999px;
  border: 1px solid var(--faint);
  background: rgba(255,255,255,.04);
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.icon-btn:hover{ border-color: var(--faint-2); background: rgba(255,255,255,.06); }

/* =========================
   Icon primitives (CSS-only)
   ========================= */
.icon{
  display:inline-block;
  width:18px;
  height:18px;
  position:relative;
}
.icon--search::before{
  content:"";
  position:absolute;
  inset:0;
  border:2px solid rgba(229,231,235,.85);
  border-radius: 999px;
  transform: scale(.70);
}
.icon--search::after{
  content:"";
  position:absolute;
  width:8px;
  height:2px;
  background: rgba(229,231,235,.85);
  right:0;
  bottom:2px;
  transform: rotate(45deg);
  transform-origin: right bottom;
}
.icon--globe{
  border:2px solid rgba(229,231,235,.85);
  border-radius: 999px;
}
.icon--globe::before,
.icon--globe::after{
  content:"";
  position:absolute;
  inset:3px;
  border:1px solid rgba(229,231,235,.55);
  border-radius: 999px;
}
.icon--globe::after{
  inset:3px 6px;
  border-left:1px solid rgba(229,231,235,.55);
  border-right:1px solid rgba(229,231,235,.55);
  border-top:none;
  border-bottom:none;
  border-radius: 0;
}
.icon--chev-down::before{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:10px;
  height:10px;
  border-right:2px solid rgba(229,231,235,.85);
  border-bottom:2px solid rgba(229,231,235,.85);
  transform: translate(-50%,-65%) rotate(45deg);
}
.icon--mail::before{
  content:"";
  position:absolute;
  inset:2px 1px;
  border:2px solid rgba(229,231,235,.85);
  border-radius: 4px;
}
.icon--mail::after{
  content:"";
  position:absolute;
  left:3px;
  right:3px;
  top:6px;
  height:0;
  border-top:2px solid rgba(229,231,235,.55);
  transform: skewY(-18deg);
}

/* =========================
   Home Page Layout
   ========================= */
.home-shell{
  min-height:100vh;
  position:relative;
  overflow:hidden;
}
.home-corner{
  position:fixed;
  z-index:50;
  font-size:14px;
  color: var(--text-2);
}
.home-corner a{ color: var(--text-2); text-decoration:none; }
.home-corner a:hover{ text-decoration: underline; }

.home-corner--tl{ top:14px; left:16px; }
.home-corner--tr{ top:14px; right:16px; }
.home-corner--bl{ bottom:14px; left:16px; }
.home-corner--br{ bottom:14px; right:16px; }

.home-center{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 96px 18px 96px;
}
.home-card{
  width:min(980px, 100%);
  text-align:center;
}
.logo{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  letter-spacing:.5px;
  font-size:34px;
  margin-bottom: 18px;
}
.subtitle{
  color: var(--muted);
  font-size:14px;
  margin-top:-8px;
  margin-bottom: 18px;
}

.home-mobile-footer{
  display:none;
}

/* Search box wrapper */
.search-wrap{
  position:relative;
  width:min(760px, 100%);
  margin: 0 auto;
}
.search-icon-right{
  position:absolute;
  right:14px;
  top:50%;
  transform: translateY(-50%);
  width:34px;
  height:34px;
  border-radius: 999px;
  border:1px solid var(--faint);
  background: rgba(255,255,255,.03);
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:auto;
  cursor:pointer;
}
.search-icon-right:focus{ outline:none; box-shadow: var(--focus); }
.search-icon-right .icon{ width:16px; height:16px; }

/* Categories grid */
.category-grid{
  margin-top: 18px;
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:10px;
  justify-items: stretch;
}

.cat-chip{
  grid-column: span 3;
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:40px;
  padding: 0 12px;
  border-radius: 999px;
  border:1px solid var(--faint);
  background: rgba(255,255,255,.03);
  color: var(--text-2);
  font-size:13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-chip:hover{ border-color: var(--faint-2); background: rgba(255,255,255,.05); color: var(--text); }

/* =========================
   Search Results Page Layout
   ========================= */
.search-shell{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}
.search-header{
  border-bottom:1px solid var(--faint);
  background: rgba(11,15,20,.92);
}
.search-header .container{
  padding-top: 14px;
  padding-bottom: 14px;
}

.search-header-row{
  display:flex;
  align-items:center;
  gap: 14px;
}
.search-header-row .logo{
  font-size:22px;
  margin:0;
}
.search-header-row .search-wrap{
  margin:0;
  flex:1;
}
.lang-trigger{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  border:1px solid var(--faint);
  background: rgba(255,255,255,.03);
  color: var(--text-2);
  cursor:pointer;
}
.lang-trigger:hover{ border-color: var(--faint-2); color: var(--text); }
.lang-trigger .icon{ width:16px; height:16px; }

/* Mobile header */
.search-header-mobile-top{
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  padding: 12px 0 10px;
}
.search-header-mobile-top .logo{
  font-size:22px;
  margin:0;
}
.search-header-mobile-top .lang-trigger{
  position:absolute;
  right:0;
  top:50%;
  transform: translateY(-50%);
}
.search-header-mobile-bottom{
  padding: 0 0 12px;
}
.search-header-mobile-bottom .search-wrap{
  width:100%;
}

/* Category strip row under header */
.category-strip-row{
  border-top:1px solid rgba(255,255,255,.06);
  padding: 10px 0 12px;
  display:flex;
  align-items:center;
  gap: 10px;
}
.category-strip{
  display:flex;
  gap:10px;
  overflow-x:auto;
  overflow-y:hidden;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling: touch;
  flex:1;
  padding-bottom: 2px;
}
.category-strip::-webkit-scrollbar{ display:none; }
.category-strip{ scrollbar-width:none; }

.category-strip .cat-chip{
  grid-column: auto;
  min-height:34px;
  font-size:13px;
  scroll-snap-align:start;
  flex: 0 0 auto;
  padding: 0 12px;
}

.more-btn{
  flex: 0 0 auto;
  height:34px;
  padding: 0 12px;
  border-radius: 999px;
  border:1px solid var(--faint);
  background: rgba(255,255,255,.03);
  color: var(--text-2);
  cursor:pointer;
}
.more-btn:hover{ border-color: var(--faint-2); color: var(--text); }

/* Main content columns */
.search-main{
  flex:1;
  padding: 18px 0 0;
}
.search-grid{
  display:grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  align-items:start;
}
.results-panel{
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
  overflow:hidden;
}
.ads-panel{
  display:flex;
  flex-direction:column;
  gap: 14px;
}
.ad-box{
  width:300px;
  height:250px;
  border-radius: 14px;
  border:1px dashed rgba(255,255,255,.16);
  background: rgba(255,255,255,.02);
  display:flex;
  align-items:center;
  justify-content:center;
  color: rgba(203,213,225,.55);
  font-size:12px;
}

/* Search results card */
.result-card{
  padding:16px;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.result-card:last-child{ border-bottom:none; }
.result-title{
  font-size:18px;
  font-weight:600;
  margin:0 0 6px 0;
}
.result-title a{ color: var(--brand); text-decoration:none; }
.result-title a:hover{ text-decoration: underline; }
.result-url{
  font-size:12px;
  color: rgba(134,239,172,.65);
  margin-bottom: 8px;
}
.result-desc{
  font-size:14px;
  color: var(--text-2);
}

.result-card {
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
a:hover .result-card {
  background: rgba(255,255,255,.035);
  border-color: rgba(255,255,255,.25);
  transform: translateY(-1px);
}

.site-tagline{
  color: #facc15;
  font-weight: 600;
  font-size:14px;
  line-height:1.55;
  display:-webkit-box;
  line-clamp:2;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

/* =========================
   Footer
   ========================= */
.search-footer{
  border-top:1px solid var(--faint);
  padding: 14px 0;
  color: var(--muted);
  font-size:12px;
}
.search-footer-row{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 16px;
}
.footer-links{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  justify-content:flex-end;
}
.footer-links a{ color: var(--muted); }
.footer-links a:hover{ color: var(--text); }

/* =========================
   Popover / Modal base
   ========================= */
.overlay{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.62);
  display:none;
  z-index: 8000;
}
.overlay.is-open{ display:block; }

.popover{
  position:fixed;
  z-index: 9000;
  left:50%;
  top: 96px;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 32px));
  max-height: calc(100vh - 120px);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.08);
  background: #0e1522;
  box-shadow: var(--shadow);
  display:none;
  overflow:hidden;
}
.popover.is-open{ display:block; }

.popover-head{
  padding: 14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.popover-title{
  font-weight:600;
}
.popover-body{
  padding: 14px 16px 18px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.popover-sep{
  height:1px;
  background: rgba(255,255,255,.06);
  margin: 14px 0;
}
.popover-grid{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
}
.popover-grid .cat-chip{
  flex: 0 0 auto;
  min-height:34px;
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 980px){
  .search-grid{
    grid-template-columns: 1fr;
  }
  .ads-panel{ display:none; }
  .result-screenshot{ display:none !important; }
}

@media (max-width: 760px){
  .search-header-row{ display:none; }

  .cat-chip{ grid-column: span 6; }
  .home-center{ padding: 90px 16px 120px; }
  .logo{ font-size:30px; }

  .home-links,
  .home-copyright{
    display:none !important;
  }

  .home-mobile-footer{
    display:block;
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    z-index:20;
    padding:10px 16px calc(env(safe-area-inset-bottom) + 10px);
    text-align:center;
    color: var(--muted);
    font-size:12px;
    background: rgba(11,15,20,.96);
    border-top:1px solid rgba(255,255,255,.06);
  }

  .home-mobile-footer .footer-links{
    justify-content:center;
  }
  .home-mobile-footer .home-mobile-copyright{
    margin-top:8px;
    color: var(--muted);
  }

  .search-footer-row{
    flex-direction:column;
    align-items:center;
    gap: 10px;
  }
  .search-footer-row .footer-links{
    justify-content:center;
    text-align:center;
  }

  .popover{
    top:16px;
    bottom:calc(env(safe-area-inset-bottom) + 16px);
    width:calc(100% - 20px);
    max-height:none;
    transform:translateX(-50%);
  }

  .popover-body{
    max-height:calc(100dvh - 140px);
    overflow-y:auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom:calc(env(safe-area-inset-bottom) + 32px);
  }
}

@media (min-width: 761px){
  .search-header-mobile-top,
  .search-header-mobile-bottom{
    display:none;
  }

  .home-mobile-footer{
    display:none !important;
  }
}