@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300;400;600&family=Fredoka+One&display=swap');

:root{
  --purple:#7C4DFF;
  --purple-soft:#ede7ff;
  --purple-soft-2:#f6f2ff;
  --purple-dark:#512DA8;
  --accent:#FFB74D;
  --accent-soft:#fff3e0;
  --danger:#e53935;
  --warn:#ffb300;
  --text:#2b2238;
  --bg-gradient:linear-gradient(to bottom, #faf5ff, #f4ecff);
}

/* Global reset-ish */
*{
  box-sizing:border-box;
}

body{ 
  margin:0;
  min-height:100vh;
  font-family:'Comfortaa', sans-serif;
  background:var(--bg-gradient);
  color:var(--text);
  line-height:1.6;
}

/* =========================
   HEADER + PIKKO BRANDING
   ========================= */

header{
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Row 1: Brand bar */
.brand-bar{
  background: #e9ddff; /* lighter purple */
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* Container holding icon + wordmark */
.brand-center{
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  position: relative;
}

/* Icon left */
.brand-left{
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

/* Wordmark centered */
.brand-middle{
  height: 38px;
  display: block;
  margin: 0 auto;
}

/* Row 2: Navigation tabs */
.nav{
  background: rgba(98,56,179,0.98);
  box-shadow: 0 2px 10px rgba(0,0,0,0.10);
}

.nav-links{
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 0;
  padding: 10px 16px;
}

.nav-links a{
  color:#fff;
  text-decoration:none;
  font-weight:600;
  font-size:0.95rem;
  padding:8px 14px;
  border-radius:999px;
  transition:all .2s ease;
}

.nav-links a:hover,
.nav-links a.active{
  background: var(--accent);
  color: #4c1d95;
  box-shadow: 0 3px 8px rgba(0,0,0,0.18);
}

/* Mobile adjustments */
@media (max-width:700px){
  .brand-center{ padding: 12px; gap: 8px; }
  .brand-icon.lg{ width: 34px; height: 34px; }
  .brand-word.lg{ height: 28px; }
  .nav-links{ flex-wrap: wrap; gap: 14px; }
}

/* =========================
   MAIN LAYOUT
   ========================= */

main{
  padding:40px 24px;
  max-width:900px;
  margin:0 auto;
}

/* Page titles */
main h1{
  font-family:'Fredoka One', sans-serif;
  font-size:2.4rem;
  letter-spacing:0.02em;
  display:flex;
  align-items:center;
  gap:10px;
}
main h1::before{ content:"🍇🍎"; }
main h1::after{ content:"🍌"; }

main p{
  margin-bottom:24px;
  opacity:0.9;
  max-width:600px;
}

/* Hero card (index page) */
.hero{
  background:var(--purple-soft-2);
  padding:24px 22px;
  border-radius:22px;
  box-shadow:0 8px 24px rgba(81,45,168,0.16);
  border:1px solid rgba(124,77,255,0.14);
}

/* Softer subheading for Upload → Scan → Result */
.hero-text h2{
  margin-top:0;
  font-family:'Comfortaa', sans-serif;
  font-size:1.4rem;
  font-weight:600;
  letter-spacing:0.01em;
}

/* =========================
   DEMO SCANNER CARD
   ========================= */

.scanner-box{
  background:var(--purple-soft-2);
  padding:26px;
  border-radius:24px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;
  box-shadow:0 10px 30px rgba(81,45,168,0.16);
  border:1px solid rgba(124,77,255,0.12);
  position:relative;
  overflow:hidden;
}

/* subtle accent blob */
.scanner-box::before{
  content:"";
  position:absolute;
  width:220px;
  height:220px;
  background:radial-gradient(circle at 30% 30%, rgba(255,183,77,0.25), transparent);
  top:-60px;
  right:-60px;
  opacity:0.85;
}

/* small fruit emoji badge */
.scanner-box::after{
  content:"🍎🍌🍊";
  position:absolute;
  top:16px;
  left:18px;
  font-size:1.4rem;
  opacity:0.9;
}

.field{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  max-width:520px;
  justify-content:center;
  position:relative;
  z-index:1;
}
.field span{
  min-width:70px;
  text-align:right;
  opacity:0.8;
  font-size:0.9rem;
}

select,
input[type=file]{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(124,77,255,0.35);
  background:#fff;
  color:var(--text);
  font-size:0.95rem;
  transition:all .2s ease;
  max-width:340px;
}
select:focus,
input[type=file]:focus{
  outline:none;
  box-shadow:0 0 0 3px rgba(124,77,255,0.18);
  border-color:var(--purple);
}

/* Preview image */
.preview{
  max-width:340px;
  position:relative;
  z-index:1;
}
.preview img{
  width:100%;
  border-radius:18px;
  box-shadow:0 8px 20px rgba(0,0,0,0.12);
  border:3px solid #fff;
  object-fit:contain;
  background:#fff;
}

/* Buttons */
.button{
  padding:10px 22px;
  background:var(--purple);
  color:#fff;
  border:none;
  border-radius:999px;
  cursor:pointer;
  font-weight:600;
  box-shadow:0 6px 15px rgba(81,45,168,0.35);
  transition:all .18s ease;
}
.button:hover:not(:disabled){
  transform:translateY(-2px);
  background:var(--purple-dark);
}
.button:disabled{
  opacity:.55;
  cursor:not-allowed;
  box-shadow:none;
}

/* Secondary button: Scan another fruit */
.button.secondary{
  background:var(--accent-soft);
  color:var(--purple-dark);
  box-shadow:0 4px 10px rgba(0,0,0,0.12);
  margin-top:4px;
}
.button.secondary:hover:not(:disabled){
  background:var(--accent);
  color:#4c1d95;
  transform:translateY(-1px);
}

/* Progress bar */
.progress-wrap{
  width:100%;
  max-width:520px;
  position:relative;
  z-index:1;
}
.progress-bar{
  height:9px;
  background:var(--accent);
  width:0%;
  border-radius:999px;
  transition:width .22s ease;
}
.progress-text{
  font-size:.8rem;
  opacity:.8;
  margin-top:6px;
  text-align:left;
}

/* Result */
.result-box{
  margin-top:10px;
  font-weight:700;
  text-align:center;
  min-height:26px;
  position:relative;
  z-index:1;
}
.result-fresh{ color:#2e7d32; }
.result-warn{ color:var(--warn); }
.result-bad{ color:var(--danger); }

/* =========================
   Ripeness ring gauge
   ========================= */

.gauge{
  margin-top:14px;
  text-align:center;
}

.gauge-ring{
  --angle: 0deg; /* filled arc angle */
  width:120px;
  height:120px;
  border-radius:50%;
  margin:0 auto;
  background:
    conic-gradient(
      #ffb74d 0deg var(--angle),      /* filled part */
      #e9ddff var(--angle) 360deg     /* empty part */
    );
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 6px 15px rgba(81,45,168,0.18);
}

.gauge-inner{
  width:78px;
  height:78px;
  border-radius:50%;
  background:#fdf9ff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  font-size:1.1rem;
  color:#4c1d95;
}

.gauge-label{
  margin-top:6px;
  font-size:0.85rem;
  opacity:0.8;
}

/* color hints for the label text */
.gauge-label.fresh{   color:#2e7d32; }
.gauge-label.overripe{color:#ffb300;}
.gauge-label.unsafe{  color:#e53935;}

/* =========================
   FOOTER
   ========================= */

footer{
  background:var(--purple-dark);
  color:#fff;
  text-align:center;
  padding:14px;
  margin-top:40px;
  font-size:.85rem;
}

/* =========================
   Scan again animation
   ========================= */

.scan-again-pop{
  animation:scanAgainPop .35s ease-out;
}

@keyframes scanAgainPop{
  0%{ transform:scale(0.6) translateY(8px); opacity:0; }
  80%{ transform:scale(1.05); opacity:1; }
  100%{ transform:scale(1); }
}

/* =========================
   Utility
   ========================= */

.hidden{
  display:none;
}

/* =========================
   Shelf Life page
   ========================= */

.shelf-card{
  background: var(--purple-soft-2);
  border-radius: 22px;
  padding: 20px 20px 16px;
  box-shadow: 0 8px 24px rgba(81,45,168,0.14);
  border: 1px solid rgba(124,77,255,0.14);
  margin-top: 20px;
}

.shelf-card-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.shelf-card-header h2{
  margin: 0;
  font-size: 1.2rem;
}

.shelf-empty{
  font-size: 0.9rem;
  opacity: 0.8;
  margin: 4px 0 10px;
}

.shelf-table-wrap{
  overflow-x: auto;
}

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

.shelf-table th,
.shelf-table td{
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(124,77,255,0.14);
  white-space: nowrap;
}

.shelf-table th{
  font-weight: 600;
  color: #4c1d95;
  background: rgba(255,255,255,0.7);
}

.shelf-table tr:nth-child(even){
  background: rgba(255,255,255,0.5);
}

@media (max-width: 600px){
  .shelf-card{
    padding: 16px 14px;
  }
  .shelf-table th,
  .shelf-table td{
    padding: 6px 8px;
    font-size: 0.8rem;
  }
}

/* =========================
   Responsive tweaks
   ========================= */

@media (max-width:700px){
  .scanner-box{
    max-width:420px;
    margin:0 auto;
  }
  .field{
    flex-direction:column;
    align-items:flex-start;
  }
  .field span{
    text-align:left;
  }
}

@media (max-width:480px){
  main h1{
    font-size:1.8rem;
  }
  .scanner-box{
    width:100%;
    padding:20px 14px;
    border-radius:18px;
  }
  .preview{
    max-width:100%;
  }
}
