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

/* Apple-like Minimalist Design */
/* Color Palette */
:root {
    --primary: #FC9303;
    --primary-hover: #fcba03;
    --background: #ffffff;
    --foreground: #000000;
    --card: #f5f5f5;
    --border: #e5e5ea;
    --muted: #8e8e93;
    --muted-bg: #f2f2f7;
    --accent: #FC9303;
}

body.dark-mode {
    --background: #000000;
    --foreground: #ffffff;
    --card: #1c1c1e;
    --border: #3a3a3c;
    --muted: #8e8e93;
    --muted-bg: #2c2c2e;
    --accent: #FC9303;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    transition: background-color 0.2s, color 0.2s;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

/* Navigation */
nav {
    border-bottom: 1px solid var(--border);
    background-color: var(--background);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--foreground);
    font-weight: 600;
    font-size: 1.125rem;
    transition: opacity 0.2s;
}

.nav-logo:hover {
    opacity: 0.8;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--foreground);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.theme-toggle:hover {
    opacity: 0.8;
}

.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--foreground);
    font-size: 0.875rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--accent);
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
}

/* Hero Section */
.hero {
    padding: 6rem 0;
    text-align: center;
}

@media (max-width: 768px) {
    .hero {
        padding: 4rem 0;
    }
}

.hero h1 {
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 2rem;
    line-height: 1.2;
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
}

.hero p {
    font-size: 1.125rem;
    color: var(--muted);
    max-width: 32rem;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

@media (min-width: 640px) {
    .hero-buttons {
        flex-direction: row;
    }
}

/* Button */
button, .btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--muted-bg);
}

/* Features Section */
.features {
    padding: 5rem 0;
    border-bottom: 1px solid var(--border);
    background-color: var(--muted-bg);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
}

.feature-item {
    space-y: 1rem;
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    background-color: var(--background);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.feature-icon svg {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--accent);
}

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

.feature-item p {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.6;
}

/* Categories Section */
.categories {
    padding: 5rem 0;
    border-bottom: 1px solid var(--border);
}

.categories h2 {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: 3rem;
}

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

.category-card {
    background-color: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.category-card:hover {
    background-color: var(--background);
    border-color: var(--accent);
}

.category-card p {
    font-weight: 600;
    color: var(--foreground);
}

/* Library Page */
.library-header {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border);
    background-color: var(--background);
    position: sticky;
    top: 3.5rem;
    z-index: 40;
}

.search-container {
    margin-bottom: 1.5rem;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: var(--muted-bg);
    color: var(--foreground);
    font-family: inherit;
}

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

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(252, 147, 3, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: var(--muted);
    pointer-events: none;
}

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

.filter-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.filter-button:hover {
    color: var(--accent);
}

.clear-filters {
    font-size: 0.75rem;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.clear-filters:hover {
    color: var(--accent);
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.filter-tag {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.75rem;
    background-color: var(--muted-bg);
    color: var(--foreground);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tag:hover {
    border-color: var(--accent);
}

.filter-tag.active {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.results-count {
    font-size: 0.875rem;
    color: var(--muted);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

/* Material Grid - 4 Columns */
.library-section {
    padding: 3rem 0;
}

.material-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .material-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .material-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.material-card {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--foreground);
    display: flex;
    flex-direction: column;
}

.material-card:hover {
    border-color: var(--accent);
}

.material-preview {
    width: 100%;
    height: 12rem;
    background-color: var(--muted-bg);
    overflow: hidden;
    position: relative;
}

.material-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.material-card:hover .material-preview img {
    transform: scale(1.05);
}

.material-preview-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.material-card:hover .material-preview-overlay {
    opacity: 1;
}

.material-content {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.material-category {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.material-name {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.material-card:hover .material-name {
    color: var(--accent);
}

.material-description {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.75rem;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.material-resolution {
    font-size: 0.75rem;
    background-color: var(--muted-bg);
    color: var(--muted);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-block;
    width: fit-content;
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
}

.no-results p {
    font-size: 1.125rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

/* Material Detail Page */
.detail-header {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    background-color: var(--background);
    position: sticky;
    top: 0;
    z-index: 50;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--foreground);
    cursor: pointer;
    font-size: 0.875rem;
    transition: opacity 0.2s;
    text-decoration: none;
}

.back-button:hover {
    opacity: 0.8;
}

.detail-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    padding: 3rem 0;
}

@media (min-width: 1024px) {
    .detail-content {
        grid-template-columns: 2fr 1fr;
    }
}

.detail-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.detail-preview {
    width: 100%;
    height: 24rem;
    background-color: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.detail-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info h1 {
    font-size: 2.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.detail-category {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.detail-description {
    font-size: 1rem;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}

.detail-meta-tag {
    background-color: var(--muted-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.usage-box {
    background-color: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.usage-box h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.usage-box p {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.6;
}

.maps-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.maps-list-simple {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.map-item {
    background-color: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
}

.map-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.map-item-type {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
}

.map-card {
    background-color: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
}

.map-type {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.map-name {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.map-description {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.map-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    transition: text-decoration 0.2s;
}

.map-download:hover {
    text-decoration: underline;
}

.map-download svg {
    width: 1rem;
    height: 1rem;
}

/* Sidebar */
.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.download-card {
    background-color: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    position: sticky;
    top: 5rem;
}

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

.download-card p {
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

.material-details-box {
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.material-details-box p {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.detail-row span:last-child {
    color: var(--foreground);
    font-weight: 500;
}

.maps-list {
    background-color: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.maps-list h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.maps-list ul {
    list-style: none;
    space-y: 0.5rem;
}

.maps-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.maps-list li::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    background-color: var(--accent);
    border-radius: 50%;
}

/* Footer */
footer {
    background-color: var(--muted-bg);
    border-top: 1px solid var(--border);
    padding: 3rem 0;
    margin-top: 3rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-column h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-column p {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.6;
}

.footer-column ul {
    list-style: none;
}

.footer-column li {
    margin-bottom: 0.5rem;
}

.footer-column a {
    font-size: 0.875rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-column a:hover {
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--background);
    border-radius: 0.75rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--foreground);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 0.8;
}

.modal-close svg {
    width: 1.5rem;
    height: 1.5rem;
}

.modal-image {
    width: 100%;
    height: 400px;
    background-color: var(--muted-bg);
    overflow: hidden;
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-body {
    padding: 1.5rem;
}

.modal-info {
    margin-bottom: 1.5rem;
}

.modal-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-info p {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.modal-download {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.modal-download-btn {
    flex: 1;
    min-width: 150px;
    padding: 0.75rem 1rem;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.modal-download-btn:hover {
    opacity: 0.8;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
}
