/* Bahá'í Writings Web Server Styles */
/* Extracted and adapted from quotes-to-html.py */

:root {
    --bg-color: #faf9f6;
    --text-color: #333;
    --quote-bg: #fff;
    --border-color: #e0d8c8;
    --link-color: #6b4c3b;
    --source-color: #666;
    --accent: #8b7355;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --quote-bg: #252525;
        --border-color: #404040;
        --link-color: #c9a872;
        --source-color: #999;
        --accent: #a08060;
    }
}

* { box-sizing: border-box; }

body {
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.7;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 4rem;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3rem;
    background: var(--quote-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9rem;
}

.navbar-brand a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.navbar-brand a:hover {
    color: var(--link-color);
}

.navbar-links {
    display: flex;
    gap: 0.25rem;
}

.navbar-links a {
    color: var(--source-color);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    transition: background-color 0.15s, color 0.15s;
}

.navbar-links a:hover {
    background: var(--border-color);
    color: var(--text-color);
}

.navbar-links a.active {
    background: var(--accent);
    color: white;
}

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

.navbar-user a {
    color: var(--source-color);
    text-decoration: none;
}

.navbar-user a:hover {
    color: var(--link-color);
}

.btn-signin, .btn-signout {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.btn-signin {
    background: var(--accent);
    color: white !important;
}

.btn-signin:hover {
    opacity: 0.9;
}

.btn-signout {
    border: 1px solid var(--border-color);
}

.btn-signout:hover {
    border-color: var(--accent);
    color: var(--accent) !important;
}

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

h1 {
    font-weight: normal;
    font-size: 1.8rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

h1 a {
    color: inherit;
    text-decoration: none;
}

h1 a:hover {
    text-decoration: underline;
}

/* Legacy nav styles (kept for compatibility) */
nav:not(.navbar) {
    margin-top: 1rem;
}

nav:not(.navbar) a {
    color: var(--link-color);
    text-decoration: none;
    margin: 0 0.5rem;
}

nav:not(.navbar) a:hover {
    text-decoration: underline;
}

/* Responsive navbar */
@media (max-width: 600px) {
    .navbar {
        padding: 0 0.75rem;
    }

    .navbar-brand {
        display: none;
    }

    .navbar-links a {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }

    .navbar-user a:not(.btn-signin):not(.btn-signout) {
        display: none;
    }
}

/* Search Form */
.search-form {
    max-width: 600px;
    margin: 2rem auto;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--quote-bg);
    color: var(--text-color);
}

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

.search-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-family: inherit;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.search-btn:hover {
    opacity: 0.9;
}

.search-options {
    margin-top: 0.75rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--source-color);
}

.search-options label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.search-options select {
    padding: 0.3rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: var(--quote-bg);
    color: var(--text-color);
}

/* Quote Cards */
.quote-card {
    background: var(--quote-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
}

.quote-number {
    position: absolute;
    top: -0.5rem;
    left: -0.5rem;
    background: var(--accent);
    color: white;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-family: sans-serif;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s ease;
}

.quote-number:hover {
    transform: scale(1.1);
}

.quote-card.flag-green .quote-number {
    background: #27ae60;
}

.quote-card.flag-green {
    border-left: 3px solid #27ae60;
}

.quote-card.flag-blue .quote-number {
    background: #2980b9;
}

.quote-card.flag-blue {
    border-left: 3px solid #2980b9;
}

.quote-text {
    margin: 0 0 1rem 0;
    font-size: 1.05rem;
}

.quote-badges {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.relevance-score {
    font-size: 0.65rem;
    font-family: sans-serif;
    color: white;
    background: var(--source-color);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.quote-tags {
    display: flex;
    gap: 0.2rem;
    flex-wrap: wrap;
}

.quote-tag {
    font-size: 0.6rem;
    font-family: sans-serif;
    color: white;
    background: #3498db;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    cursor: pointer;
}

.quote-tag:hover {
    background: #2980b9;
}

.add-tag {
    font-size: 0.6rem;
    font-family: sans-serif;
    color: var(--source-color);
    background: var(--quote-bg);
    border: 1px dashed var(--border-color);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    cursor: pointer;
}

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

.add-to-collection {
    font-size: 0.7rem;
    font-family: sans-serif;
    color: white;
    background: var(--accent);
    border: none;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
}

.add-to-collection:hover {
    opacity: 0.8;
}

.quote-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--source-color);
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.source-name {
    font-style: italic;
}

.source-link {
    color: var(--link-color);
    text-decoration: none;
}

.source-link:hover {
    text-decoration: underline;
}

/* Highlights */
.highlight {
    padding: 0.1em 0.2em;
    border-radius: 3px;
    font-weight: 600;
}

.highlight-yellow { background-color: #ffeb3b; }
.highlight-blue { background-color: #90caf9; }
.highlight-green { background-color: #a5d6a7; }
.highlight-pink { background-color: #f48fb1; }
.highlight-orange { background-color: #ffcc80; }
.highlight-purple { background-color: #ce93d8; }
.highlight-cyan { background-color: #80deea; }

@media (prefers-color-scheme: dark) {
    .highlight-yellow { background-color: #ffc107; color: #000; }
    .highlight-blue { background-color: #1976d2; color: #fff; }
    .highlight-green { background-color: #388e3c; color: #fff; }
    .highlight-pink { background-color: #c2185b; color: #fff; }
    .highlight-orange { background-color: #e65100; color: #fff; }
    .highlight-purple { background-color: #7b1fa2; color: #fff; }
    .highlight-cyan { background-color: #00838f; color: #fff; }
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.85rem;
}

.filter-bar label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    color: var(--source-color);
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group strong {
    font-size: 0.8rem;
    color: var(--source-color);
}

/* Results Info */
.results-info {
    text-align: center;
    color: var(--source-color);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.results-info .query {
    font-style: italic;
    color: var(--accent);
}

/* Error Messages */
.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

@media (prefers-color-scheme: dark) {
    .error {
        background: #3d1f22;
        border-color: #5a2a2f;
        color: #f5c6cb;
    }
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--source-color);
    font-size: 0.9rem;
}

footer a {
    color: var(--link-color);
}

/* Auth Forms */
.auth-form {
    max-width: 400px;
    margin: 2rem auto;
    background: var(--quote-bg);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.auth-form h2 {
    text-align: center;
    color: var(--accent);
    margin-top: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--source-color);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group small {
    display: block;
    margin-top: 0.3rem;
    color: var(--source-color);
    font-size: 0.8rem;
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--quote-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
}

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

.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--source-color);
}

.auth-link a {
    color: var(--link-color);
}

/* Flash Messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.flash.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.flash.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.flash.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

@media (prefers-color-scheme: dark) {
    .flash.error {
        background: #3d1f22;
        border-color: #5a2a2f;
        color: #f5c6cb;
    }
    .flash.success {
        background: #1f3d26;
        border-color: #2a5a34;
        color: #c3e6cb;
    }
    .flash.info {
        background: #1f3d3d;
        border-color: #2a5a5a;
        color: #bee5eb;
    }
}

/* Profile Page */
.profile-page {
    max-width: 600px;
    margin: 2rem auto;
}

.profile-page h2 {
    color: var(--accent);
}

.profile-info, .profile-stats {
    background: var(--quote-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.profile-info p, .profile-stats p {
    margin: 0.5rem 0;
}

.profile-stats h3 {
    margin-top: 0;
    color: var(--accent);
}

.profile-actions {
    text-align: center;
}

/* Tag Picker */
.tag-picker {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--quote-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
}

.tag-picker-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.tag-input {
    flex: 1;
    padding: 0.4rem;
    font-size: 0.85rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}

.tag-input:focus {
    outline: none;
    border-color: var(--accent);
}

.tag-add-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.tag-add-btn:hover {
    opacity: 0.9;
}

.tag-list {
    max-height: 150px;
    overflow-y: auto;
}

.tag-item {
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.tag-item:hover {
    background: var(--border-color);
}

.tag-item.selected {
    background: var(--accent);
    color: white;
}

/* Collections */
.collections-page {
    max-width: 800px;
    margin: 0 auto;
}

.collections-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.collections-header h2 {
    margin: 0;
    color: var(--accent);
}

.collections-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.collection-card {
    background: var(--quote-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

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

.collection-info h3 {
    margin: 0 0 0.5rem 0;
}

.collection-info h3 a {
    color: var(--text-color);
    text-decoration: none;
}

.collection-info h3 a:hover {
    color: var(--accent);
}

.collection-description {
    color: var(--source-color);
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
}

.collection-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--source-color);
}

.public-badge {
    background: #27ae60;
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
}

.collection-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--quote-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
}

.btn-small:hover {
    border-color: var(--accent);
}

.btn-danger {
    color: #c0392b;
}

.btn-danger:hover {
    background: #c0392b;
    color: white;
    border-color: #c0392b;
}

.empty-state {
    text-align: center;
    color: var(--source-color);
    padding: 3rem 1rem;
}

.empty-state a {
    color: var(--link-color);
}

/* Collection View */
.collection-view {
    max-width: 800px;
    margin: 0 auto;
}

.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.collection-title {
    flex: 1;
}

.back-link {
    color: var(--source-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.5rem;
}

.back-link:hover {
    color: var(--accent);
}

.collection-title h2 {
    margin: 0;
    color: var(--accent);
}

.collection-title .collection-description {
    margin-top: 0.5rem;
}

.collection-actions-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.collection-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--source-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.drag-hint {
    font-style: italic;
    font-size: 0.8rem;
}

/* Quote card in collection view */
.collection-view .quote-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.collection-view .quote-card.dragging {
    opacity: 0.5;
}

.collection-view .quote-content {
    flex: 1;
}

.collection-view .quote-text {
    margin: 0 0 0.75rem 0;
}

.collection-view .quote-notes {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--source-color);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
}

.quote-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--quote-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--source-color);
}

.btn-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--quote-bg);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-top: 0;
    color: var(--accent);
}

.modal-content .form-group {
    margin-bottom: 1rem;
}

.modal-content .form-group label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--source-color);
    font-size: 0.9rem;
}

.modal-content .form-group input[type="text"],
.modal-content .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}

.modal-content .form-group input:focus,
.modal-content .form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-content .form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.modal-actions .btn-primary {
    width: auto;
    padding: 0.5rem 1.5rem;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 1rem;
    }

    .search-input-group {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
    }

    .auth-form {
        margin: 1rem;
        padding: 1.5rem;
    }

    .collections-header {
        flex-direction: column;
        align-items: stretch;
    }

    .collection-card {
        flex-direction: column;
    }

    .collection-actions {
        align-self: flex-end;
    }

    .collection-header {
        flex-direction: column;
    }

    .collection-actions-header {
        width: 100%;
        justify-content: flex-end;
    }
}
