/* ====================================
   DSE Calculator Program Library
   Modern UI Styles
   ==================================== */

/* CSS Variables */
:root {
    /* Colors - Cyberpunk/Tech aesthetic */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --bg-card-hover: #222230;
    
    --accent-primary: #00d4ff;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
    --accent-glow: 0 0 20px rgba(0, 212, 255, 0.3);
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(0, 212, 255, 0.3);
    
    /* Typography */
    --font-primary: 'Noto Sans HK', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --container-width: 1200px;
    --section-padding: 100px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Animation */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-primary);
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-secondary);
    bottom: -150px;
    left: -150px;
    animation-delay: -7s;
}

.shape-3 {
    width: 400px;
    height: 400px;
    background: #ff006e;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, -50px) scale(1.1); }
    50% { transform: translate(-30px, 30px) scale(0.95); }
    75% { transform: translate(40px, 40px) scale(1.05); }
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 24px;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.2rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-primary);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 24px 80px;
    gap: 60px;
    max-width: var(--container-width);
    margin: 0 auto;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.badge {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-xl);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-primary);
    margin-bottom: 24px;
    font-family: var(--font-mono);
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 24px;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.8;
}

.hero-stats {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: var(--accent-gradient);
    color: var(--bg-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition-normal);
    box-shadow: var(--accent-glow);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.4);
}

/* Calculator Preview */
.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
}

.calculator-preview {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 300px;
    box-shadow: 
        0 0 60px rgba(0, 212, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: calcFloat 6s ease-in-out infinite;
}

@keyframes calcFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.calc-screen {
    background: #1a2f1a;
    border-radius: var(--radius-sm);
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: #90ee90;
    min-height: 150px;
    margin-bottom: 16px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.calc-line {
    margin-bottom: 8px;
    opacity: 0;
    animation: typeLine 0.5s forwards;
}

.calc-line:nth-child(1) { animation-delay: 0.5s; }
.calc-line:nth-child(2) { animation-delay: 1s; }
.calc-line:nth-child(3) { animation-delay: 1.5s; }

@keyframes typeLine {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.calc-cursor {
    display: inline-block;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.calc-brand {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 2px;
}

/* Section Styles */
.programs-section,
.tutorial-section,
.about-section {
    padding: var(--section-padding) 24px;
    max-width: var(--container-width);
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Filter Container */
.filter-container {
    margin-bottom: 40px;
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 16px 20px 16px 56px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    transition: var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--accent-glow);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: var(--font-primary);
}

.filter-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-gradient);
    color: var(--bg-primary);
    border-color: transparent;
}

/* Program Cards Grid */
.programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.program-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.program-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transition: var(--transition-normal);
}

.program-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-accent);
    box-shadow: var(--accent-glow);
}

.program-card:hover::before {
    transform: scaleX(1);
}

.program-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.program-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.program-category {
    font-size: 0.8rem;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    padding: 4px 10px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: var(--radius-sm);
}

.program-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

.program-preview {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-primary);
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 100px;
    margin-bottom: 16px;
}

.program-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.program-difficulty {
    display: flex;
    gap: 4px;
}

.difficulty-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.difficulty-dot.active {
    background: var(--accent-primary);
}

.program-bytes {
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent-secondary);
    background: rgba(0, 206, 201, 0.1);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
}

.program-mode {
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #00ff88;
    background: rgba(0, 255, 136, 0.15);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
}

.modal-bytes {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-secondary);
    background: rgba(0, 206, 201, 0.15);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.program-card:hover .view-btn {
    color: var(--accent-primary);
}

/* Tutorial Section */
.tutorial-content {
    display: grid;
    gap: 40px;
}

.tutorial-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    position: relative;
}

.step-number {
    font-size: 3rem;
    font-weight: 700;
    color: rgba(0, 212, 255, 0.15);
    font-family: var(--font-mono);
    position: absolute;
    top: 16px;
    right: 20px;
}

.step-card h3 {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

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

.key-sequence {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.key-sequence.large {
    justify-content: center;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
}

.key {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.key.small {
    padding: 4px 8px;
    font-size: 0.75rem;
}

.arrow {
    color: var(--text-muted);
}

.text {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.symbol-guide {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.symbol-guide h3 {
    margin-bottom: 24px;
    font-size: 1.3rem;
}

.symbol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.symbol-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.symbol {
    display: block;
    font-size: 1.8rem;
    font-family: var(--font-mono);
    color: var(--accent-primary);
    margin-bottom: 12px;
}

.symbol-keys {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
}

.symbol-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.run-guide {
    text-align: center;
}

.run-guide h3 {
    margin-bottom: 20px;
    font-size: 1.3rem;
}

/* About Section */
.about-section {
    padding-bottom: 60px;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-content h2 {
    font-size: 2rem;
    margin-bottom: 24px;
}

.about-content > p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 40px;
}

.disclaimer {
    background: rgba(255, 200, 0, 0.1);
    border: 1px solid rgba(255, 200, 0, 0.3);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: left;
}

.disclaimer h4 {
    color: #ffc800;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.disclaimer ul {
    list-style: none;
}

.disclaimer li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.disclaimer li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #ffc800;
}

/* Footer */
.footer {
    padding: 40px 24px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer-content p {
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    z-index: 10;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.modal-content {
    padding: 40px;
}

.modal-header {
    margin-bottom: 32px;
}

.modal-category {
    font-size: 0.85rem;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    margin-bottom: 8px;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.modal-description {
    color: var(--text-secondary);
    line-height: 1.7;
}

.modal-section {
    margin-bottom: 32px;
}

.modal-section h4 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.code-block {
    background: #0d0d12;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.code-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    color: var(--accent-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: var(--font-primary);
}

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

.code-content {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--accent-primary);
    white-space: pre-wrap;
    overflow-x: auto;
}

.usage-list {
    list-style: none;
}

.usage-list li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.usage-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
}

.example-box {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
}

.example-box h5 {
    color: #a78bfa;
    margin-bottom: 12px;
}

.example-box p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.example-box code {
    display: inline-block;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--accent-primary);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--accent-glow);
    z-index: 300;
    opacity: 0;
    transition: var(--transition-normal);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast svg {
    color: #22c55e;
}

/* Responsive */
@media (max-width: 900px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding-top: 100px;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .hero-visual {
        order: -1;
    }
    
    .calculator-preview {
        width: 250px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .programs-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .modal-content {
        padding: 24px;
    }
    
    .modal-title {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .category-filters {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }
    
    .filter-btn {
        white-space: nowrap;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Selection */
::selection {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

