/* Cairo - Educational Resource Marketplace Styles */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
}

.nav-brand .tagline {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

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

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
}

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

.hero p {
    font-size: 1.125rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

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

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

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

.hero .btn-secondary {
    background-color: transparent;
    color: white;
    border-color: white;
}

.hero .btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Sections */
section {
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

section h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

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

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

.category-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.category-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

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

.category-children {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.category-children span {
    display: inline-block;
    background: var(--background);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin: 0.25rem;
    color: var(--text-secondary);
}

/* Content Types Grid */
.content-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

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

.content-type-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.content-type-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-input, .filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: var(--card-bg);
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.search-input:focus, .filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Resources Grid */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.resource-card {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.resource-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.resource-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.resource-card .meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.resource-card .description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.resource-card .stats {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.resource-card .price {
    font-weight: 600;
    color: var(--success-color);
}

.resource-card .price.paid {
    color: var(--warning-color);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

footer a:hover {
    color: var(--primary-color);
}

/* User Info (logged in state) */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

/* Clickable Cards */
.resource-card.clickable {
    cursor: pointer;
}

.resource-card.clickable:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Resource Detail Page */
.resource-detail-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.resource-header {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.breadcrumb {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

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

.resource-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.resource-meta .content-type {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
}

.resource-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.resource-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.resource-stats .price {
    font-weight: 600;
    color: var(--success-color);
}

.resource-stats .price.paid {
    color: var(--warning-color);
}

.resource-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Resource Content Section */
.resource-content {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.resource-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Atoms List (generic) */
.atoms-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.atom-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
}

.atom-number {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 2rem;
}

.atom-content p {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.atom-content p:last-child {
    margin-bottom: 0;
}

.atom-content strong {
    color: var(--text-primary);
}

/* Vocabulary List Table */
.vocabulary-list {
    overflow-x: auto;
}

.vocab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.vocab-table th,
.vocab-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.vocab-table th {
    background: var(--background);
    font-weight: 600;
    color: var(--text-primary);
}

.vocab-row {
    cursor: pointer;
    transition: background 0.2s;
}

.vocab-row:hover {
    background: var(--background);
}

.vocab-num {
    width: 3rem;
    color: var(--text-secondary);
}

.vocab-term {
    cursor: pointer;
}

.vocab-term:hover strong {
    color: var(--primary-color);
}

.vocab-term strong {
    display: block;
    color: var(--text-primary);
    transition: color 0.2s;
}

.vocab-term .pronunciation {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.vocab-action {
    width: 2.5rem;
    text-align: center;
}

.view-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--background);
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.2s;
}

.view-link:hover {
    background: var(--primary-color);
    color: white;
}

.vocab-category,
.vocab-grade {
    color: var(--text-secondary);
}

.vocab-expand {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
}

.tag.dolch {
    background: #dbeafe;
    color: #1e40af;
}

.tag.fry {
    background: #dcfce7;
    color: #166534;
}

.pos {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    background: var(--background);
    color: var(--text-secondary);
}

/* Vocabulary Details Row */
.vocab-details {
    background: #f1f5f9;
}

.vocab-details td {
    padding: 0;
}

.details-content {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
}

.details-content p {
    margin-bottom: 0.5rem;
}

.details-content p:last-child {
    margin-bottom: 0;
}

.details-content em {
    color: var(--text-secondary);
}

/* Error State */
.error-state {
    text-align: center;
    padding: 4rem 2rem;
}

.error-state h2 {
    color: #ef4444;
    margin-bottom: 1rem;
}

.error-state p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Atom Detail Page */
.atom-detail-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.atom-header {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.atom-nav-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.atom-position {
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--background);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
}

.atom-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.atom-meta a {
    color: var(--primary-color);
    text-decoration: none;
}

.atom-meta a:hover {
    text-decoration: underline;
}

/* Vocabulary Word Detail */
.vocab-word-detail {
    text-align: center;
    padding: 1rem 0;
}

.vocab-term {
    font-size: 3rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.vocab-pronunciation {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1.5rem;
}

.vocab-badges {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge.pos {
    background: var(--background);
    color: var(--text-secondary);
}

.badge.category {
    background: #e0e7ff;
    color: #3730a3;
}

.badge.grade {
    background: #fef3c7;
    color: #92400e;
}

.badge.dolch {
    background: #dbeafe;
    color: #1e40af;
}

.badge.fry {
    background: #dcfce7;
    color: #166534;
}

.badge.type {
    background: #f3e8ff;
    color: #7c3aed;
}

.vocab-section {
    text-align: left;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.vocab-section h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.vocab-section p {
    font-size: 1.125rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.example-sentence {
    font-style: italic;
    color: var(--text-secondary) !important;
}

.word-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.word-chip {
    background: var(--background);
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.word-chip.antonym {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* Atom Navigation */
.atom-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-btn.nav-disabled {
    visibility: hidden;
}

.nav-arrow {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.nav-title {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-top: 0.25rem;
    text-align: center;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-back {
    background: var(--background);
}

.nav-back .nav-title {
    max-width: 200px;
}

/* Generic Content Fields */
.generic-content {
    text-align: left;
}

.content-field {
    margin-bottom: 1.5rem;
}

.content-field h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.content-field p {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
}

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

    .hero h2 {
        font-size: 1.75rem;
    }

    .hero-actions {
        flex-direction: column;
    }

    .filters {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }
}
