/* diyStudio - Modern CSS Stylesheet */

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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* Navigation */
.navbar {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-brand a:hover {
    color: var(--primary-dark);
}

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

.nav-menu .btn {
    margin: 0;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    padding: 0.5rem 0;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* Marketplace page background */
.main-content:has(.marketplace-page) {
    background: #faf8f3; /* Soft beige background */
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-header .subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* Content Sections */
.content-section {
    margin-top: 2rem;
}

.welcome-card,
.info-card {
    background: var(--surface);
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.welcome-card h2,
.info-card h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-card h3,
.info-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-card p,
.info-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-card {
    background: var(--surface);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Feature List */
.feature-list {
    list-style: none;
    padding-left: 0;
}

.feature-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-secondary:hover {
    background-color: #475569;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Action Section */
.action-section {
    margin-top: 2rem;
    text-align: center;
}

/* Error Page */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.error-content {
    text-align: center;
    max-width: 600px;
}

.error-content h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.error-message {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Footer */
footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .welcome-card,
    .info-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .welcome-card,
    .info-card {
        padding: 1rem;
    }
}

/* ============================================
   Marketplace / Apps Grid Styles - Pastel Theme
   ============================================ */

.marketplace-page {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    background: #faf8f3; /* Soft beige background */
    min-height: calc(100vh - 200px);
    border-radius: 1rem;
}

/* Marketplace Header with Filters */
.marketplace-header {
    margin-bottom: 2.5rem;
}

.filters-container {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Search Bar */
.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #e8ddd4; /* Soft beige border */
    border-radius: 0.75rem;
    font-size: 1rem;
    background-color: #ffffff;
    color: #5a4a3a; /* Soft brown text */
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #d4a574; /* Soft pastel brown */
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.15);
    background-color: #ffffff;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.125rem;
    pointer-events: none;
    opacity: 0.4;
    color: #8b7355; /* Soft muted brown */
}

/* Category Dropdown */
.category-wrapper {
    min-width: 220px;
}

.category-select {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border: 1px solid #e8ddd4; /* Soft beige border */
    border-radius: 0.75rem;
    font-size: 1rem;
    background-color: #ffffff;
    color: #5a4a3a; /* Soft brown text */
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b7355' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.category-select:focus {
    outline: none;
    border-color: #d4a574; /* Soft pastel brown */
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.15);
}

.category-select option {
    padding: 0.5rem;
}

/* Apps Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* App Card */
.app-card {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(139, 115, 85, 0.08), 0 1px 3px rgba(139, 115, 85, 0.05);
    border: 1px solid #f0e8dd; /* Very soft beige border */
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 1;
}

.app-card:not(.visible) {
    display: none;
}

.app-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(139, 115, 85, 0.12), 0 4px 8px rgba(139, 115, 85, 0.08);
    border-color: #e8ddd4;
}

/* App Icon */
.app-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-icon svg {
    width: 100%;
    height: 100%;
}


/* App Category Badge */
.app-category {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: #8b7355; /* Soft muted brown */
}

.category-icon {
    font-size: 1rem;
}

.category-name {
    font-weight: 500;
}

/* App Name */
.app-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: #5a4a3a; /* Soft brown text */
    margin-bottom: 0.75rem;
}

/* App Description */
.app-description {
    color: #6b5d4a; /* Softer brown for description */
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

/* App Link Button */
.app-link {
    width: 100%;
    text-align: center;
    margin-top: auto;
}

.btn-primary {
    background-color: #d4a574; /* Soft pastel brown */
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary:hover {
    background-color: #c89664; /* Slightly darker on hover */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.25);
}

.btn-secondary {
    background-color: #e8ddd4; /* Soft beige */
    color: #6b5d4a; /* Soft brown text */
    border: 1px solid #d4c4b4;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
}

.app-link.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.app-link.disabled:hover {
    transform: none;
    box-shadow: none;
    background-color: #e8ddd4;
}

/* No Results Message */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #8b7355; /* Soft muted brown */
    font-size: 1.125rem;
}

/* Responsive Design for Marketplace */
@media (max-width: 768px) {
    .marketplace-page {
        padding: 1.5rem 1rem;
    }

    .filters-container {
        flex-direction: column;
    }

    .search-wrapper,
    .category-wrapper {
        width: 100%;
    }

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

@media (max-width: 480px) {
    .marketplace-page {
        padding: 1rem 0.75rem;
    }

    .apps-grid {
        grid-template-columns: 1fr;
    }

    .app-card {
        padding: 1.25rem;
    }
}
