/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background-color: #f9fafb;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.logo-text p {
    font-size: 0.875rem;
    color: #6b7280;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    text-decoration: none;
    color: #4b5563;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav a:hover {
    color: #3b82f6;
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 0;
    height: 2px;
    background: #3b82f6;
    transition: width 0.3s ease;
}

.nav a:hover::after {
    width: 100%;
}

.github-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #1f2937;
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.github-btn:hover {
    background: #374151;
    transform: translateY(-1px);
}

/* Hero Section */
.hero {
    position: relative;
    background: linear-gradient(135deg, #dbeafe 0%, #ffffff 50%, #faf5ff 100%);
    padding: 5rem 0 6rem;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
}

.hero-content {
    position: relative;
    text-align: center;
    max-width: 64rem;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
}

.hero-description {
    font-size: 1.25rem;
    color: #6b7280;
    margin-bottom: 3rem;
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 4rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1.125rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: white;
    color: #1f2937;
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
    border-color: #d1d5db;
    background: #f9fafb;
    transform: translateY(-2px);
}

.hero-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 64rem;
    margin: 0 auto;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
}

.feature-icon.blue { background: #dbeafe; color: #3b82f6; }
.feature-icon.green { background: #d1fae5; color: #10b981; }
.feature-icon.purple { background: #ede9fe; color: #8b5cf6; }

.feature-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: #6b7280;
}

/* Structures Section */
.structures-section {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.section-header p {
    font-size: 1.25rem;
    color: #6b7280;
    max-width: 48rem;
    margin: 0 auto;
}

/* Search and Filter */
.search-filter {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-box, .filter-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box svg, .filter-box svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.search-box input, .filter-box select {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.search-box input:focus, .filter-box select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Structure Cards */
.structures-grid {
    display: grid;
    gap: 2rem;
}

.structure-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #f3f4f6;
    overflow: hidden;
    transition: all 0.3s ease;
}

.structure-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.expand-btn {
    padding: 0.5rem 1rem;
    background: #eff6ff;
    color: #3b82f6;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.expand-btn:hover {
    background: #dbeafe;
}

.card-description {
    color: #6b7280;
    font-size: 1.125rem;
    line-height: 1.6;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    padding: 1rem;
    background: #f9fafb;
    flex-wrap: wrap;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    color: #4b5563;
}

.tab-btn.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.tab-btn:hover:not(.active) {
    background: #f3f4f6;
}

/* Tab Content */
.tab-content {
    padding: 1.5rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Overview Content */
.overview-section {
    margin-bottom: 2rem;
}

.overview-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.overview-section.advantages h4 { color: #059669; }
.overview-section.disadvantages h4 { color: #dc2626; }
.overview-section.use-cases h4 { color: #3b82f6; }

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

.overview-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    color: #4b5563;
}

.overview-list li::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.advantages .overview-list li::before { background: #10b981; }
.disadvantages .overview-list li::before { background: #ef4444; }
.use-cases .overview-list li::before { background: #3b82f6; }

/* Language Tabs */
.language-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.language-tab {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.875rem;
}

.language-tab.active {
    background: #1f2937;
    color: white;
}

.language-tab:hover:not(.active) {
    background: #e5e7eb;
}

/* Code Block */
.code-block {
    background: #1f2937;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #374151;
    border-bottom: 1px solid #4b5563;
}

.code-dots {
    display: flex;
    gap: 0.5rem;
}

.code-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
}

.code-dot.red { background: #ef4444; }
.code-dot.yellow { background: #f59e0b; }
.code-dot.green { background: #10b981; }

.code-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.code-language {
    color: #9ca3af;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: #4b5563;
    color: #d1d5db;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #6b7280;
}

.code-content {
    padding: 1rem;
    overflow-x: auto;
}

.code-content pre {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #f3f4f6;
}

/* Web Challenge Button */
.web-challenge-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    margin-top: 1rem;
}

.web-challenge-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.3);
}

/* Complexity Analysis */
.complexity-grid {
    display: grid;
    gap: 1.5rem;
}

.complexity-section {
    padding: 1.5rem;
    border-radius: 0.75rem;
}

.complexity-section.time {
    background: #eff6ff;
}

.complexity-section.space {
    background: #ecfdf5;
}

.complexity-section h5 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.complexity-section.time h5 { color: #1d4ed8; }
.complexity-section.space h5 { color: #059669; }

.complexity-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.complexity-item {
    text-align: center;
}

.complexity-operation {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

.complexity-section.time .complexity-operation { color: #1d4ed8; }
.complexity-section.space .complexity-operation { color: #059669; }

.complexity-value {
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: 0.5rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    font-weight: 700;
}

.complexity-section.time .complexity-value { color: #1d4ed8; }
.complexity-section.space .complexity-value { color: #059669; }

.space-complexity {
    text-align: center;
}

.space-complexity-value {
    display: inline-block;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 0.5rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 1.125rem;
    font-weight: 700;
    color: #059669;
}

/* Quick Reference */
.quick-reference {
    background: #f9fafb;
    padding: 4rem 0;
}

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

.reference-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 2rem;
}

.reference-card h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* Complexity Guide */
.complexity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.complexity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.complexity-item:hover {
    background: #f3f4f6;
}

.complexity-notation {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: 700;
    font-size: 0.875rem;
}

.complexity-notation.green { background: #d1fae5; color: #065f46; }
.complexity-notation.blue { background: #dbeafe; color: #1e40af; }
.complexity-notation.yellow { background: #fef3c7; color: #92400e; }
.complexity-notation.orange { background: #fed7aa; color: #9a3412; }
.complexity-notation.red { background: #fecaca; color: #991b1b; }

.complexity-info strong {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.complexity-info p {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Tips List */
.tips-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.tip-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: #eff6ff;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    flex-shrink: 0;
}

.tip-item strong {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.tip-item p {
    color: #6b7280;
}

/* Footer */
.footer {
    background: #1f2937;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand .logo {
    margin-bottom: 1rem;
}

.footer-description {
    color: #9ca3af;
    margin-bottom: 1.5rem;
    max-width: 24rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: #374151;
    color: #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

.link-group h4 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.link-group ul {
    list-style: none;
}

.link-group ul li {
    margin-bottom: 0.5rem;
}

.link-group ul li a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.3s ease;
}

.link-group ul li a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-bottom p {
    color: #9ca3af;
    font-size: 0.875rem;
}

.footer-love {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.heart {
    color: #ef4444;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        height: auto;
        padding: 1rem 0;
        gap: 1rem;
    }
    
    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    
    .hero {
        padding: 3rem 0 4rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .hero-features {
        grid-template-columns: 1fr;
    }
    
    .search-filter {
        flex-direction: column;
    }
    
    .search-box, .filter-box {
        min-width: auto;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .language-tabs {
        flex-direction: column;
    }
    
    .complexity-items {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .reference-grid {
        grid-template-columns: 1fr;
    }
    
    .reference-card {
        min-width: auto;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .section-header h2 {
        font-size: 2rem;
    }
    
    .section-header p {
        font-size: 1rem;
    }
    
    .complexity-items {
        grid-template-columns: 1fr;
    }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.structure-card {
    animation: fadeInUp 0.6s ease-out;
}

.feature-card:hover .feature-icon {
    animation: pulse 0.6s ease-in-out;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Focus Styles */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .header,
    .hero,
    .footer {
        display: none;
    }
    
    .structure-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}