/* 
  Glassmorphism UI Showcase Styles
  Modern, responsive, and high-performance vanilla CSS
*/

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Inter:wght@400;500&display=swap');

:root {
  /* Light Mode Variables */
  --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --glass-bg: rgba(255, 255, 255, 0.4);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --accent-color: #6c63ff;
  --blob-1: #6c63ff;
  --blob-2: #ff6584;
  --blob-3: #43e97b;
  --code-bg: #1e1e1e;
  --code-text: #d4d4d4;
  --blur: 12px;
}

[data-theme="dark"] {
  /* Dark Mode Variables */
  --bg-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --accent-color: #00d2ff;
  --blob-1: #00d2ff;
  --blob-2: #9d50bb;
  --blob-3: #f7971e;
  --blur: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.5s ease;
}

/* --- Navigation Routing & Animations --- */

.page {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  padding-top: 120px;
  min-height: 100vh;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.page.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.nav-item {
  position: relative;
  opacity: 0.6;
}

.nav-item.active {
  opacity: 1;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-color);
  border-radius: 2px;
}

/* --- Refined Glass UI --- */

.cta-button.primary {
  background: var(--accent-color);
  color: white;
}

.cta-button.secondary {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* --- Playground & Inputs --- */

.demo-controls {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.demo-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.cta-btn-sm {
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--accent-color);
  color: white;
  transition: opacity 0.2s;
}

.cta-btn-sm.ghost {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.glass-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 300px;
}

.glass-input {
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  padding: 0.8rem 1rem 0.8rem 2.5rem;
  border-radius: 12px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.3s;
}

.glass-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.input-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  width: 16px;
  height: 16px;
}

/* --- Contact & Forms --- */

.contact-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
  align-items: start;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.social-grid {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.social-item {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--glass-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  transition: all 0.3s;
}

.social-item:hover {
  background: var(--accent-color);
  color: white;
  transform: translateY(-3px);
}

/* --- Library Search & Interactive --- */

.search-container {
    margin-bottom: 2rem;
}

.clear-btn {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-primary);
    opacity: 0.5;
    cursor: pointer;
    display: none;
}

.search-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.search-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.search-item.hidden {
    display: none;
}

/* Demo box for interactions */
.demo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.demo-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 3D Orb */
.orb-container {
    width: 60px;
    height: 60px;
    perspective: 1000px;
}

.glass-orb {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.4), rgba(255,255,255,0.05));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    animation: rotateOrb 4s infinite linear;
}

@keyframes rotateOrb {
    from { transform: rotateY(0deg) rotateX(0deg); }
    to { transform: rotateY(360deg) rotateX(360deg); }
}

/* Dice */
.dice-container {
    width: 50px;
    height: 50px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--glass-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dice-container:active {
    transform: scale(0.8) rotate(15deg);
}

/* Sparkling Coin */
.coin {
    width: 50px;
    height: 50px;
    background: #ffd700;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    animation: coinSpin 2s infinite linear;
}

.coin-shine {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.8), transparent);
    animation: shine 1s infinite linear;
}

@keyframes coinSpin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Form Hints & Stats */
.hint {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-left: 0.5rem;
    transition: color 0.3s;
}

.hint.valid {
    color: #43e97b;
    opacity: 1;
}

.hint.invalid {
    color: #ff6584;
    opacity: 1;
}



/* --- Lightbox Modal --- */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(20px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox.active {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.lightbox-close:hover {
    background: var(--blob-2);
    transform: scale(1.1) rotate(90deg);
}

.lightbox-content {
    max-width: 90%;
    max-height: 80%;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

/* --- Library Advanced Layout --- */

.library-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .library-layout {
        grid-template-columns: 1fr;
    }
}

.library-sidebar {
    height: fit-content;
}

.library-preview {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.clickable {
    cursor: pointer;
}

.search-item.clickable:hover {
    border-color: var(--accent-color);
    background: var(--glass-border);
    padding-left: 1.5rem;
}

.search-item.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.preview-render {
    min-height: 150px;
}

/* Custom UI Components for Preview */

.glass-preview-btn {
    padding: 1rem 2rem;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    color: var(--text-primary);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.glass-preview-loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--glass-border);
    border-bottom-color: var(--accent-color);
    border-radius: 50%;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.glass-preview-switch {
    width: 60px;
    height: 30px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    position: relative;
    cursor: pointer;
}

.glass-preview-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.glass-preview-switch.on::after {
    left: 32px;
    background: var(--accent-color);
}

/* Showcase Item Overlay */

.showcase-item {
    position: relative;
    overflow: hidden;
}

.showcase-item img {
    transition: transform 0.6s;
    display: block;
}

.showcase-item:hover img {
    transform: scale(1.05);
}

.item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    transform: translateY(100%);
    transition: transform 0.4s;
    pointer-events: none;
}

.showcase-item:hover .item-overlay {
    transform: translateY(0);
}

/* Animations */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Responsiveness Expansion --- */

@media (max-width: 900px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .hero-actions {
    flex-direction: column;
    width: 100%;
  }
  .hero-actions button {
    width: 100%;
  }
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -1px;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: opacity 0.3s;
}

.nav-links a:hover {
  opacity: 0.7;
}

.theme-toggle {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur));
  padding: 0.5rem 1rem;
  border-radius: 50px;
  cursor: pointer;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-toggle:hover {
  transform: scale(1.05);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5%;
}

/* --- Background Blobs --- */

.background-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: move 20s infinite alternate;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: var(--blob-1);
  top: -100px;
  left: -100px;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: var(--blob-2);
  bottom: -150px;
  right: -100px;
  animation-delay: -5s;
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: var(--blob-3);
  top: 40%;
  left: 50%;
  animation-delay: -10s;
}

@keyframes move {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(100px, 100px) scale(1.2); }
}

/* --- Hero Section --- */

.hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  font-weight: 700;
  background: linear-gradient(180deg, var(--text-primary) 0%, rgba(255,255,255,0) 200%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fadeInUp 1s ease forwards;
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 2.5rem;
  animation: fadeInUp 1s ease 0.2s forwards;
  opacity: 0;
}

/* --- Buttons --- */

.cta-button {
  padding: 1rem 2.5rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 50px;
  border: none;
  background: var(--accent-color);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  animation: fadeInUp 1s ease 0.4s forwards;
  opacity: 0;
}

.cta-button.secondary {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.cta-button.ghost {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  box-shadow: none;
}

.cta-button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.cta-button:active {
  transform: translateY(-1px) scale(0.98);
}

.cta-button.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
  pointer-events: none;
}

/* --- Showcase Section --- */

.showcase {
  padding: 100px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 4rem;
}

.section-title h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

/* Glass Card Component */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 24px;
  padding: 2.5rem;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s;
  position: relative;
  overflow: hidden;
}

.glass-card:hover {
  transform: translateY(-10px);
}

/* Profile Card Specifics */
.profile-card {
  text-align: center;
}

.profile-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-color);
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
}

.profile-card h3 {
  margin-bottom: 0.5rem;
}

.profile-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Feature/Stats Card Specifics */
.stats-number {
  font-size: 3rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.5rem;
  color: var(--accent-color);
}

/* Pricing Card Specifics */
.pricing-card .price {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 1.5rem 0;
  display: block;
}

.pricing-card ul {
  list-style: none;
  margin-bottom: 2rem;
  text-align: left;
}

.pricing-card li {
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

/* --- CSS Section --- */

.css-guide {
  padding: 100px 0;
}

.code-block {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 2rem;
  border-radius: 16px;
  font-family: 'Inter', monospace;
  position: relative;
  overflow-x: auto;
  margin-top: 2rem;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.8rem;
}

.copy-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: rgba(255,255,255,0.2);
}

pre {
  margin: 0;
  font-size: 0.9rem;
}

.code-keyword { color: #569cd6; }
.code-property { color: #9cdcfe; }
.code-value { color: #ce9178; }
.code-selector { color: #d7ba7d; }

/* --- Footer --- */

footer {
  padding: 4rem 0;
  text-align: center;
  border-top: 1px solid var(--glass-border);
  margin-top: 4rem;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.social-links a {
  color: var(--text-primary);
  opacity: 0.6;
  transition: opacity 0.3s;
}

.social-links a:hover {
  opacity: 1;
}

/* --- Animations --- */

@keyframes fadeInUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* --- Responsive --- */

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  
  .hero h1 {
    font-size: 3rem;
  }
  
  .card-grid {
    grid-template-columns: 1fr;
  }
}
