/*
Theme Name: Face Insights App Theme
Theme URI: https://pix-code.com/
Author: Pix Code
Author URI: https://pix-code.com/
Description: Modern app-like WordPress theme tailored for the Face Insights AI plugin. Lightweight, RTL-friendly, WooCommerce-ready, with Customizer controls.
Version: 1.1.7
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: face-insights-app
Tags: one-column, custom-colors, custom-logo, rtl-language-support, e-commerce
*/

:root{
  --fi-accent: #6d5efc;
  --fi-accent-2: #8b5cf6;
  --fi-bg-1: #0b1220;
  --fi-bg-2: #0e2a3a;
  --fi-surface: rgba(255,255,255,.07);
  --fi-surface-2: rgba(255,255,255,.10);
  --fi-border: rgba(255,255,255,.14);
  --fi-text: rgba(255,255,255,.92);
  --fi-muted: rgba(255,255,255,.70);
  --fi-radius: 22px;
  --fi-shadow: 0 16px 50px rgba(0,0,0,.35);
  --fi-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{
  margin:0;
  min-height:100vh;
  color:var(--fi-text);
  font-family:var(--fi-font);
  background:
    radial-gradient(900px 600px at 15% 15%, rgba(109,94,252,.35), transparent 60%),
    radial-gradient(900px 600px at 85% 10%, rgba(139,92,246,.30), transparent 60%),
    linear-gradient(135deg, var(--fi-bg-1), var(--fi-bg-2));
}

a{ color:inherit; text-decoration:none; }
a:hover{ opacity:.92; }
img{ max-width:100%; height:auto; }

.dia-shell{
  width:min(1100px, 92vw);
  margin: 0 auto;
  padding: 34px 0 70px;
}
.dia-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding: 14px 18px;
  border: 1px solid var(--fi-border);
  background: linear-gradient(180deg, var(--fi-surface), transparent);
  border-radius: calc(var(--fi-radius) + 6px);
  box-shadow: var(--fi-shadow);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 18px;
  z-index: 40;
}

.dia-brand{
  display:flex; align-items:center; gap:10px;
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
}
.dia-dot{
  width: 10px; height:10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--fi-accent), var(--fi-accent-2));
  box-shadow: 0 0 0 4px rgba(109,94,252,.18);
}

.dia-menu-toggle{
  display:none;
  border:1px solid var(--fi-border);
  background: rgba(255,255,255,.06);
  color: var(--fi-text);
  border-radius: 14px;
  padding: 10px 12px;
  cursor:pointer;
  align-items:center;
  justify-content:center;
  min-width: 44px;
  min-height: 44px;
}
.dia-menu-toggle:hover{ transform: translateY(-1px); }
.dia-burger{
  width: 18px; height: 12px; position: relative; display:block;
}
.dia-burger:before,
.dia-burger:after,
.dia-burger i{
  content:"";
  position:absolute;
  left:0; right:0;
  height:2px;
  background: rgba(255,255,255,.90);
  border-radius: 999px;
}
.dia-burger:before{ top:0; }
.dia-burger i{ top:5px; }
.dia-burger:after{ bottom:0; }
.dia-sr{
  position:absolute;
  width:1px; height:1px;
  padding:0; margin:-1px; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap; border:0;
}
.dia-nav{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  font-size: 14px;
}
.dia-pill{
  display:inline-flex; align-items:center; justify-content:center;
  padding: 9px 12px;
  border-radius: 999px;
  border:1px solid var(--fi-border);
  background: rgba(255,255,255,.06);
  transition: transform .15s ease, opacity .15s ease;
}
.dia-pill:hover{ transform: translateY(-1px); }

.dia-card{
  margin-top: 22px;
  border: 1px solid var(--fi-border);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  border-radius: calc(var(--fi-radius) + 10px);
  box-shadow: var(--fi-shadow);
  backdrop-filter: blur(14px);
  overflow:hidden;
}
.dia-card-inner{
  padding: 22px;
}
.dia-title{
  margin: 0 0 8px 0;
  font-size: clamp(22px, 2.3vw, 30px);
}
.dia-muted{ color: var(--fi-muted); }

.dia-content{
  margin-top: 18px;
}
.dia-content .entry-content{
  color: var(--fi-text);
}

/* Make common WP blocks look app-like */
.wp-block{
  max-width: 100%;
}
body.dia-theme:not(.fi-plugin-page) .wp-block-group{
  border: 1px solid var(--fi-border);
  background: rgba(255,255,255,.05);
  border-radius: var(--fi-radius);
  padding: 16px;
}

/* Buttons */
body.dia-theme:not(.fi-plugin-page) button,
body.dia-theme:not(.fi-plugin-page) input[type="submit"],
body.dia-theme:not(.fi-plugin-page) .button,
body.dia-theme:not(.fi-plugin-page) .wp-element-button,
body.dia-theme:not(.fi-plugin-page) a.button{
  border-radius: 999px !important;
}
body.dia-theme:not(.fi-plugin-page) .woocommerce a.button,
body.dia-theme:not(.fi-plugin-page) .woocommerce button.button,
body.dia-theme:not(.fi-plugin-page) .woocommerce input.button{
  background: linear-gradient(135deg, var(--fi-accent), var(--fi-accent-2));
  color: #fff;
  border: 0;
  padding: 10px 14px;
}
body.dia-theme:not(.fi-plugin-page) .woocommerce a.button:hover,
body.dia-theme:not(.fi-plugin-page) .woocommerce button.button:hover,
body.dia-theme:not(.fi-plugin-page) .woocommerce input.button:hover{
  opacity: .95;
}

/* Forms */
body.dia-theme:not(.fi-plugin-page) input[type="text"],
body.dia-theme:not(.fi-plugin-page) input[type="email"],
body.dia-theme:not(.fi-plugin-page) input[type="tel"],
body.dia-theme:not(.fi-plugin-page) input[type="url"],
body.dia-theme:not(.fi-plugin-page) input[type="password"],
body.dia-theme:not(.fi-plugin-page) textarea,
body.dia-theme:not(.fi-plugin-page) select{
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(255,255,255,.06);
  color: var(--fi-text);
  padding: 12px 14px;
  outline: none;
}
body.dia-theme:not(.fi-plugin-page) input::placeholder,
body.dia-theme:not(.fi-plugin-page) textarea::placeholder{ color: rgba(255,255,255,.55); }
body.dia-theme:not(.fi-plugin-page) input:focus,
body.dia-theme:not(.fi-plugin-page) textarea:focus,
body.dia-theme:not(.fi-plugin-page) select:focus{
  border-color: rgba(109,94,252,.65);
  box-shadow: 0 0 0 4px rgba(109,94,252,.18);
}

/* Footer */
.dia-footer{
  margin-top: 18px;
  display:flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(255,255,255,.65);
}

.dia-blank .dia-topbar,
.dia-blank .dia-footer{
  display:none !important;
}
.dia-blank .dia-shell{ padding-top: 18px; }

/* Responsive */
@media (max-width: 720px){
  .dia-shell{ padding: 18px 0 54px; }
  .dia-topbar{ padding: 12px 14px; position: sticky; top: 14px; z-index: 50; flex-wrap: wrap; }
  .dia-card-inner{ padding: 16px; }
  .dia-menu-toggle{ display:inline-flex; }
  .dia-nav{ display:none; width:100%; flex-direction:column; align-items:stretch; gap:10px; padding-top: 10px; }
  body.dia-menu-open .dia-nav{ display:flex; }
  .dia-nav a{ display:block; }
  .dia-nav .dia-pill{ width:100%; justify-content:flex-start; }
}



/* --- Face Insights App: mobile stability hardening --- */
html, body{
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
  overscroll-behavior-x: none;
}
body{
  touch-action: pan-y;
}
#dia-primary-nav{
  touch-action: manipulation;
}
pre, code{
  white-space: pre-wrap;
  word-break: break-word;
}
table{
  display:block;
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
}
img, video, iframe, canvas, svg{
  max-width:100%;
}



/* --- Plugin integration: let Face Insights AI own the UI (avoid double cards) --- */
body.fi-plugin-page .dia-card{
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}
body.fi-plugin-page .dia-card-inner{
  padding: 0;
}
body.fi-plugin-page .dia-content{
  margin-top: 0;
}


/* --- Plugin page styling isolation (Hybrid mode) --- */
body.fi-plugin-page{
  /* Theme provides background + topbar only; plugin owns UI components */
}


/* --- Desktop Menu Position (Customizer) --- */
@media (min-width: 721px){
  /* In RTL: flex-start is RIGHT, so "Right" = near brand, "Left" = opposite side */
  html[dir="rtl"] body.dia-menu-right .dia-topbar{ justify-content: flex-start; }
  html[dir="rtl"] body.dia-menu-left  .dia-topbar{ justify-content: space-between; }

  /* In LTR: flex-start is LEFT, so "Left" = near brand, "Right" = opposite side */
  html[dir="ltr"] body.dia-menu-left  .dia-topbar{ justify-content: flex-start; }
  html[dir="ltr"] body.dia-menu-right .dia-topbar{ justify-content: space-between; }
}


/* --- Accessibility: clear focus states (keyboard) --- */
:where(a, button, .button, input, select, textarea):focus{ outline: none; }
:where(a, button, .button, input, select, textarea):focus-visible{
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--fi-accent, #8b5cf6) 25%, transparent);
  border-color: color-mix(in srgb, var(--fi-accent, #8b5cf6) 45%, transparent);
}



/* --- WooCommerce My Account: App-like forms (scoped, does not touch plugin pages) --- */
body:not(.fi-plugin-page) .woocommerce .woocommerce-form,
body:not(.fi-plugin-page) .woocommerce form.login,
body:not(.fi-plugin-page) .woocommerce form.register{
  background: color-mix(in srgb, var(--fi-surface, rgba(255,255,255,.07)) 70%, rgba(2,6,23,.88));
  border: 1px solid var(--fi-border, rgba(255,255,255,.10));
  border-radius: calc(var(--fi-radius, 22px) + 8px);
  padding: 18px;
}

body:not(.fi-plugin-page) .woocommerce form .form-row{
  margin: 0 0 12px;
}

body:not(.fi-plugin-page) .woocommerce form input[type="text"],
body:not(.fi-plugin-page) .woocommerce form input[type="email"],
body:not(.fi-plugin-page) .woocommerce form input[type="password"]{
  width: 100%;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--fi-text, #e8eefc);
  padding: 0 14px;
}

body:not(.fi-plugin-page) .woocommerce form label{
  color: var(--fi-muted, #9fb0d6);
  font-weight: 800;
  margin-bottom: 6px;
}

body:not(.fi-plugin-page) .woocommerce button.button,
body:not(.fi-plugin-page) .woocommerce input.button{
  width: 100%;
  height: 48px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(90deg, var(--fi-accent-2, #8b5cf6), var(--fi-accent, #3b82f6));
  color: #fff;
  font-weight: 900;
}

body:not(.fi-plugin-page) .woocommerce .woocommerce-error,
body:not(.fi-plugin-page) .woocommerce .woocommerce-message,
body:not(.fi-plugin-page) .woocommerce .woocommerce-info{
  border-radius: 18px;
  border-color: rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--fi-text, #e8eefc);
}

body:not(.fi-plugin-page) .woocommerce .woocommerce-privacy-policy-text{
  color: var(--fi-muted, #9fb0d6);
}
