/* Modern clean styles for PyScript Package Tracker */
:root{
  /* PyScript dark mode (slate) colors */
  --md-hue: 232;
  --bg: hsla(var(--md-hue),15%,21%,1);
  --card: hsla(var(--md-hue),15%,15%,1);
  --muted: hsla(var(--md-hue),75%,90%,0.62);
  --accent: #ffa724; /* PyScript orange */
  --accent-2: #fa8900; /* PyScript dark orange */
  --white: hsla(var(--md-hue),75%,95%,1);
  --glass: hsla(var(--md-hue),15%,21%,0.07);
}

/* Light theme */
@media (prefers-color-scheme: light){
  :root{
    --md-hue: 232;
    --bg:#ffffff;
    --card:#ffffff;
    --muted: hsla(var(--md-hue),25%,35%,1);
    --accent: #fa8900; /* PyScript dark orange for better contrast */
    --accent-2: #d97706;
    --white: hsla(var(--md-hue),25%,10%,1);
    --glass: rgba(0,0,0,0.02);
  }
  body{
    background: #f7fafc !important;
  }
  .hero-inner{
    background: linear-gradient(180deg, rgba(250,137,0,0.06), rgba(217,119,6,0.02));
    box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.05);
    border: none;
  }
  .card{
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  }
  .card h3{
    color:#1a202c;
  }
  .card:hover{
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  .app-content{
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  }
  .site-header{
    border-bottom:1px solid #e2e8f0;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(10px);
  }
  .site-footer{
    border-top:1px solid #e2e8f0;
  }
  .search-controls input[type="text"]{
    border:1px solid #cbd5e0;
    background:#ffffff;
    color:#1a202c;
  }
  .search-controls input::placeholder{
    color:#1a202c !important;
    opacity:0.6 !important;
  }
  .search-controls input:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 3px rgba(250,137,0,0.15);
  }
  .app-content pre{
    background:#f7fafc;
    border:1px solid #e2e8f0;
  }
  .app-content code{
    background:#edf2f7;
    color:#6b4ce6;
  }
  .app-content th, .app-content td{
    border-bottom:1px solid #e2e8f0;
  }
  .btn{
    box-shadow: 0 2px 8px rgba(250,137,0,0.25);
    color:#000000 !important;
  }
  .btn:hover{
    box-shadow:0 8px 20px rgba(250,137,0,0.35);
  }
  .btn:active{
    box-shadow:0 4px 12px rgba(250,137,0,0.3);
  }
  .btn::before{
    background:rgba(255,255,255,0.4);
  }
  .brand-accent{
    color:var(--accent);
  }
  .hero-title{
    color:#1a202c;
  }
  .hero-sub{
    color:#2d3748;
  }
  .hint{
    color:#2d3748;
  }
  .loading-text::before{
    border:3px solid rgba(250,137,0,0.2);
    border-top-color:var(--accent);
  }
  .footer-inner{
    color:#2d3748;
  }
  .footer-inner a{
    color:#2d3748;
  }
  .section-title{
    color:#1a202c;
  }
  .section-subtitle{
    color:#2d3748;
  }
  .key-item{
    color:#2d3748;
  }
  .package-grid:not(:has(.package-item))::before{
    border:4px solid rgba(250,137,0,0.2);
    border-top-color:var(--accent);
  }
  .package-item{
    background:#ffffff;
    border:1px solid #e2e8f0;
    box-shadow:0 2px 8px rgba(0,0,0,0.06);
  }
  .package-item.status-green{
    background:linear-gradient(180deg, rgba(22,163,74,0.04), rgba(22,163,74,0.01));
  }
  .package-item.status-green::before{
    background:#16a34a;
  }
  .package-item.status-amber{
    background:linear-gradient(180deg, rgba(217,119,6,0.04), rgba(217,119,6,0.01));
  }
  .package-item.status-amber::before{
    background:#d97706;
  }
  .package-item.status-red{
    background:linear-gradient(180deg, rgba(220,38,38,0.04), rgba(220,38,38,0.01));
  }
  .package-item.status-red::before{
    background:#dc2626;
  }
  .package-item:hover{
    box-shadow:0 4px 16px rgba(0,0,0,0.12);
    border-color:#cbd5e0;
  }
  .package-name{
    color:#1a202c;
  }
  .package-desc{
    color:#2d3748;
  }
  .status-badge.green{color:#16a34a}
  .status-badge.amber{color:#d97706}
  .status-badge.red{color:#dc2626}
  .help-content img{
    border:2px solid #e2e8f0 !important;
  }
  .help-content pre{
    background:#f7fafc !important;
    border:1px solid #e2e8f0 !important;
  }
  .help-content pre code{
    color:#1a202c !important;
  }
  .help-content p code{
    background:rgba(250,137,0,0.15) !important;
    color:#d97706 !important;
  }
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: var(--bg);
  color:var(--white);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
.container{
  width:100%;
  max-width:1100px;
  margin:0 auto;
  padding:0 20px;
}

.site-header{
  border-bottom:1px solid rgba(255,255,255,0.04);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
}
.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding-top:18px;
  padding-bottom:18px;
}
.brand{
  display:flex;
  align-items:center;
  gap:0.5rem;
  font-weight:700;
  font-size:1.125rem;
  color:var(--white);
  text-decoration:none;
  transition:opacity 0.2s;
}
.brand:hover{
  opacity:0.85;
}
.brand-logo{
  width:48px;
  height:48px;
  color:var(--accent);
  flex-shrink:0;
}
.brand-accent{color:var(--accent); margin-left:6px; font-weight:800}
.nav a{color:var(--accent); text-decoration:none; margin-left:18px}
.nav a:hover{color:var(--white)}

.site-main{padding:40px 0 80px}
.hero{padding:40px 20px;}
.hero-inner{background:linear-gradient(180deg, rgba(255,167,36,0.08), rgba(250,137,0,0.03)); border-radius:14px; padding:36px; box-shadow:0 6px 24px rgba(0,0,0,0.4)}
.hero-title{margin:0 0 8px; font-size:clamp(1.6rem,3.5vw,2.4rem); line-height:1.05}
.hero-sub{margin:0 0 18px; color:var(--muted)}
.hint{margin-top:10px; color:var(--muted); font-size:0.95rem}
.hint a{color:var(--accent); text-decoration:underline}
.hint a:hover{color:var(--accent-2); text-decoration:none}
.hint a:visited{color:var(--accent)}

.search-form{margin-top:8px}
.search-controls{display:flex; gap:10px; align-items:center}
.search-controls input[type="text"]{
  flex:1; padding:12px 14px; border-radius:10px; border:1px solid rgba(255,255,255,0.06); background:var(--glass); color:var(--white); outline:none; font-size:1rem;
}
.search-controls input::placeholder{color:rgba(255,255,255,0.45)}
.btn{display:inline-block; padding:11px 16px; background:linear-gradient(90deg,var(--accent),var(--accent-2)); color:#000000; border-radius:10px; border:none; font-weight:700; cursor:pointer; transition:transform 0.2s ease, box-shadow 0.2s ease; position:relative; overflow:hidden}
.btn:hover{filter:brightness(1.1); transform:translateY(-2px); box-shadow:0 8px 20px rgba(255,167,36,0.4)}
.btn:active{transform:translateY(0); box-shadow:0 4px 12px rgba(255,167,36,0.3)}
.btn::before{content:''; position:absolute; top:50%; left:50%; width:0; height:0; border-radius:50%; background:rgba(255,255,255,0.3); transform:translate(-50%,-50%); transition:width 0.6s ease, height 0.6s ease}
.btn:hover::before{width:300px; height:300px}

.features{display:grid; grid-template-columns:repeat(3,1fr); gap:18px; margin-top:28px}
.card{background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); padding:18px; border-radius:12px; border:1px solid rgba(255,255,255,0.03)}
.card h3{margin:0 0 8px}
.card p{margin:0; color:var(--muted)}

.site-footer{border-top:1px solid rgba(255,255,255,0.03); padding:18px 0; margin-top:40px}
.footer-inner{display:flex; align-items:center; justify-content:center; color:var(--muted)}
.footer-inner a{color:var(--muted); text-decoration:underline}

/* accessibility helpers */
.sr-only{position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden}

/* Popular packages section */
.popular-packages{margin-top:60px}
.section-title{font-size:1.8rem; margin:0 0 8px; text-align:center; color:var(--white)}
.section-subtitle{text-align:center; color:var(--muted); margin:0 0 20px}
.status-key{display:flex; justify-content:center; gap:24px; margin-bottom:24px; flex-wrap:wrap}
.key-item{display:flex; align-items:center; gap:6px; color:var(--muted); font-size:0.95rem}
.package-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:16px; min-height:200px; position:relative}
.package-grid:not(:has(.package-item))::before{
  content:'';
  position:absolute;
  left:50%;
  top:50%;
  margin-left:-20px;
  margin-top:-20px;
  width:40px;
  height:40px;
  border:4px solid rgba(255,167,36,0.2);
  border-top-color:var(--accent);
  border-radius:50%;
  animation:spin 0.8s linear infinite;
}
.package-item{
  display:block;
  background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border:1px solid rgba(255,255,255,0.03);
  border-radius:10px;
  padding:16px;
  text-decoration:none;
  color:var(--white);
  transition:all 0.2s ease;
  position:relative;
}
.package-item::before{
  content:'';
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:4px;
  border-radius:10px 0 0 10px;
  opacity:0.6;
}
.package-item.status-green::before{
  background:#4ade80;
}
.package-item.status-amber::before{
  background:#fbbf24;
}
.package-item.status-red::before{
  background:#f87171;
}
.package-item.status-green{
  background:linear-gradient(180deg, rgba(74,222,128,0.05), rgba(74,222,128,0.02));
}
.package-item.status-amber{
  background:linear-gradient(180deg, rgba(251,191,36,0.05), rgba(251,191,36,0.02));
}
.package-item.status-red{
  background:linear-gradient(180deg, rgba(248,113,113,0.05), rgba(248,113,113,0.02));
}
.package-item:hover{
  transform:translateY(-2px);
  border-color:rgba(255,255,255,0.1);
  box-shadow:0 4px 16px rgba(0,0,0,0.3);
}
.package-header{display:flex; align-items:center; justify-content:space-between; margin-bottom:8px}
.package-name{font-weight:700; font-size:1.1rem; color:var(--white)}
.package-desc{margin:0; font-size:0.9rem; color:var(--muted); line-height:1.4}
.status-badge{font-size:1.2rem; line-height:1}
.status-badge.green{color:#4ade80}
.status-badge.amber{color:#fbbf24}
.status-badge.red{color:#f87171}

/* Package detail page styles */
.app-content{
  background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); 
  padding:24px; 
  border-radius:12px; 
  border:1px solid rgba(255,255,255,0.03);
  min-height:400px;
}
.loading-text{
  color:var(--muted); 
  text-align:center; 
  padding:40px 0;
  font-style:italic;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
}
.loading-text::before{
  content:'';
  width:20px;
  height:20px;
  border:3px solid rgba(255,167,36,0.2);
  border-top-color:var(--accent);
  border-radius:50%;
  animation:spin 0.8s linear infinite;
}
@keyframes spin{
  to{transform:rotate(360deg)}
}
.app-content h2{
  margin-top:0; 
  color:var(--accent-2);
  font-size:1.6rem;
}
.app-content h3{
  color:var(--white); 
  margin-top:24px;
  font-size:1.2rem;
}
.app-content p{
  line-height:1.6; 
  color:var(--muted);
}
.app-content a{
  color:var(--accent); 
  text-decoration:none;
}
.app-content a:hover{
  text-decoration:underline;
}
.app-content code{
  background:rgba(255,255,255,0.05); 
  padding:2px 6px; 
  border-radius:4px; 
  font-size:0.9em;
  color:var(--accent-2);
}
.app-content pre{
  background:var(--card); 
  padding:16px; 
  border-radius:8px; 
  overflow-x:auto;
  border:1px solid rgba(255,255,255,0.04);
}
.app-content ul, .app-content ol{
  line-height:1.7; 
  color:var(--muted);
}
.app-content table{
  width:100%; 
  border-collapse:collapse; 
  margin:16px 0;
}
.app-content th, .app-content td{
  padding:10px 12px; 
  text-align:left; 
  border-bottom:1px solid rgba(255,255,255,0.05);
}
.app-content th{
  color:var(--white); 
  font-weight:600;
}
.app-content td{
  color:var(--muted);
}

/* Help page */
.help-content{
  max-width:800px;
  margin:0 auto;
  padding:40px 0;
}
.help-content h1{
  margin:0 0 32px;
  font-size:clamp(1.8rem,4vw,2.5rem);
  color:var(--white);
}
.help-content h2{
  margin:32px 0 16px;
  color:var(--white);
}
.help-content p{
  margin:0 0 20px;
  line-height:1.7;
  color:var(--muted);
}
.help-content a{
  color:var(--accent);
  text-decoration:underline;
}
.help-content a:hover{
  color:var(--accent-2);
}
.help-content ul, .help-content ol{
  line-height:1.7;
  color:var(--muted);
}
.help-content li{
  color:var(--muted);
}
.help-content pre{
  background:rgba(0,0,0,0.3);
  border:1px solid rgba(255,255,255,0.1);
  border-radius:6px;
  padding:16px;
  margin:16px 0;
  overflow-x:auto;
}
.help-content code{
  font-family:'Courier New', Courier, monospace;
  font-size:0.9em;
}
.help-content pre code{
  background:none;
  border:none;
  padding:0;
  color:var(--white);
}
.help-content p code{
  background:rgba(255,167,36,0.15);
  padding:2px 6px;
  border-radius:3px;
  color:var(--accent);
}
.help-content img{
  max-width:100%;
  height:auto;
  display:block;
  margin:24px 0;
  border-radius:8px;
  border:2px solid rgba(255,255,255,0.3);
}

/* Responsive */
@media (max-width:880px){
  .features{grid-template-columns:repeat(2,1fr)}
  .package-grid{grid-template-columns:repeat(auto-fill, minmax(240px, 1fr))}
}
@media (max-width:560px){
  .features{grid-template-columns:1fr}
  .header-inner{padding-top:12px; padding-bottom:12px}
  .hero-inner{padding:20px}
  .search-controls{flex-direction:column}
  .btn{width:100%}
  .package-grid{grid-template-columns:1fr}
  .section-title{font-size:1.5rem}
}
