/* BeeWiki Styles */

:root {
    --color-primary: #f4a825;
    --color-primary-dark: #d48c1f;
    --color-secondary: #2c3e50;
    --color-text: #333;
    --color-text-light: #666;
    --color-bg: #fff;
    --color-bg-alt: #f8f9fa;
    --color-border: #e1e4e8;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --color-info: #17a2b8;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Monaco', 'Menlo', monospace;
    --max-width: 1200px;
    --spacing: 1rem;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    margin: 0;
    padding: 0;
}

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

a:hover {
    text-decoration: underline;
}

/* Header */
.site-header {
    background: var(--color-secondary);
    color: white;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

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

.nav-links a {
    color: rgba(255,255,255,0.85);
}

.nav-links a:hover {
    color: white;
}

.search-form {
    display: flex;
}

.search-form input {
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 4px 0 0 4px;
    width: 200px;
}

.search-form button {
    padding: 0.4rem 0.75rem;
    background: var(--color-primary);
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

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

.nav-user a, .nav-user .btn-link {
    color: rgba(255,255,255,0.85);
}

.username {
    color: var(--color-primary);
}

.btn-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
}

/* Main content */
.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 200px);
}

/* Footer */
.site-footer {
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem;
    text-align: center;
    color: var(--color-text-light);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s;
}

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

.btn-primary:hover {
    background: var(--color-primary-dark);
    text-decoration: none;
}

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

.btn-secondary:hover {
    background: var(--color-border);
    text-decoration: none;
}

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

.btn-warning {
    background: var(--color-warning);
    color: var(--color-text);
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Home page */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 3rem;
    margin: 0 0 0.5rem;
}

.tagline {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

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

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

/* Activity list */
.activity-list {
    list-style: none;
    padding: 0;
}

.activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.activity-type {
    background: var(--color-bg-alt);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.activity-user {
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.activity-time {
    color: var(--color-text-light);
    font-size: 0.8rem;
    margin-left: auto;
}

/* Species list */
.species-table {
    width: 100%;
    border-collapse: collapse;
}

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

.species-table th {
    background: var(--color-bg-alt);
    font-weight: 600;
}

.species-table tr:hover {
    background: var(--color-bg-alt);
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-critically-endangered { background: #d32f2f; color: white; }
.status-endangered { background: #f57c00; color: white; }
.status-vulnerable { background: #fbc02d; color: black; }
.status-near-threatened { background: #7cb342; color: white; }
.status-least-concern { background: #4caf50; color: white; }
.status-data-deficient { background: #9e9e9e; color: white; }
.status-not-evaluated { background: #e0e0e0; color: black; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1rem;
}

.page-info {
    color: var(--color-text-light);
}

/* Species page */
.species-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.species-title h1 {
    margin: 0;
    font-size: 2rem;
}

.authority {
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.common-name {
    font-size: 1.25rem;
    color: var(--color-text-light);
    margin: 0.25rem 0 0;
}

.species-actions {
    display: flex;
    gap: 0.5rem;
}

.species-content-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .species-content-grid {
        grid-template-columns: 1fr;
    }
}

.species-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-box {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
}

.info-box h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: var(--color-text-light);
}

.info-box dl {
    margin: 0;
}

.info-box dt {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 0.5rem;
}

.info-box dd {
    margin: 0;
    font-weight: 500;
}

.external-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.external-links li {
    margin: 0.25rem 0;
}

.wiki-section {
    margin-bottom: 2rem;
}

.wiki-section h2 {
    font-size: 1.25rem;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.wiki-content {
    line-height: 1.8;
}

.wiki-content p {
    margin: 0 0 1rem;
}

.empty-content {
    text-align: center;
    padding: 3rem;
    background: var(--color-bg-alt);
    border-radius: 8px;
}

/* Edit page */
.edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.save-status {
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.save-status.success {
    background: #d4edda;
    color: #155724;
}

.save-status.error {
    background: #f8d7da;
    color: #721c24;
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.field-help {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin: 0 0 0.5rem;
}

.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
}

.editor-container textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    resize: vertical;
}

.editor-container .preview {
    padding: 0.75rem;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    min-height: 100px;
    overflow: auto;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.editor-help {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--color-bg-alt);
    border-radius: 8px;
}

.editor-help h3 {
    margin: 0 0 0.5rem;
}

.editor-help code {
    background: white;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

/* Login page */
.login-page {
    max-width: 400px;
    margin: 2rem auto;
}

.login-box {
    background: var(--color-bg-alt);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.login-box h1 {
    margin: 0 0 0.5rem;
}

.login-intro {
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

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

.login-success {
    text-align: center;
}

.login-success h2 {
    color: var(--color-success);
}

.alert {
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
}

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

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: 1rem;
}

.modal-body pre {
    background: var(--color-bg-alt);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Tables */
.history-table,
.changes-table,
.watchlist-table {
    width: 100%;
    border-collapse: collapse;
}

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

.history-table th,
.changes-table th,
.watchlist-table th {
    background: var(--color-bg-alt);
}

/* Search */
.search-form-large {
    display: flex;
    margin-bottom: 2rem;
}

.search-form-large input {
    flex: 1;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--color-border);
    border-radius: 4px 0 0 4px;
}

.search-form-large button {
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.search-results {
    list-style: none;
    padding: 0;
}

.search-result {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.search-result:hover {
    background: var(--color-bg-alt);
}

.result-name {
    font-size: 1.1rem;
}

.result-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* Error page */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
}

.error-page h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

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

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

/* Utility */
.text-muted {
    color: var(--color-text-light);
}

.no-results,
.no-activity,
.no-history,
.no-changes,
.no-watchlist {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-light);
}

/* Filter form */
.list-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-form {
    display: flex;
    gap: 0.5rem;
}

.filter-form input {
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.btn-clear {
    color: var(--color-text-light);
}

.result-count {
    color: var(--color-text-light);
    margin: 0;
}
/* ============================================================
   Data Edit Tabs - APPEND to existing beewiki.css
   ============================================================ */

/* Tab Navigation */
.edit-tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 1.5rem;
    gap: 0;
}

.edit-tab {
    padding: 0.625rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.edit-tab:hover { background: #f5f5f5; color: #333; }
.edit-tab.active { color: #333; border-bottom-color: #f5c518; font-weight: 600; }

/* Tab Panels */
.edit-tab-panel { display: none; }
.edit-tab-panel.active { display: block; }

/* Data Sections */
.data-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}
.data-section:last-child { border-bottom: none; }
.data-section h3 { margin: 0 0 0.75rem; font-size: 1rem; }

/* Chips */
.chip-container { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; min-height: 2rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #e8f4f8;
    border-radius: 4px;
    font-size: 0.875rem;
}
.chip.primary { background: #fff3cd; }
.chip button {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: #666;
    padding: 0 0.125rem;
}
.chip button:hover { color: #c00; }

/* Add Row */
.add-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.add-row select { max-width: 200px; }
.inline-label { display: flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; white-space: nowrap; }

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}
.data-table th, .data-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.data-table th { font-weight: 600; color: #666; }
.btn-remove {
    border: none;
    background: none;
    color: #c00;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.125rem 0.375rem;
}
.btn-remove:hover { background: #fee; border-radius: 2px; }

/* Form Grids */
.form-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1rem; }

/* Range Inputs */
.range-inputs { display: flex; align-items: center; gap: 0.5rem; }
.range-inputs input { width: 70px; }
.range-inputs span { color: #666; }

/* Empty State */
.empty { color: #999; font-style: italic; }
.empty-notice { padding: 1rem; background: #f9f9f9; border-radius: 4px; text-align: center; color: #666; }

/* Add Form */
.add-form { background: #f9f9f9; padding: 1rem; border-radius: 4px; }
.add-form h3 { margin-top: 0; }

/* History Table */
.history-table td { font-size: 0.8125rem; }

/* ===========================================
   Search Input with Clear Button - UPDATED
   REPLACE the previous search-clear styles in beewiki.css
   =========================================== */

/* Wrapper - works in flex contexts and standalone */
.search-input-wrapper {
    position: relative;
    display: inline-flex;
    flex: 1;
    min-width: 0; /* Allow shrinking in flex */
}

.search-input-wrapper input {
    width: 100%;
    padding-right: 2rem; /* Space for X button */
    margin: 0; /* Reset any margins */
}

/* Clear button - reset all button styles */
.search-clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    border: none !important;
    background: none !important;
    color: #888 !important;
    font-size: 1.25rem;
    font-weight: 300;
    cursor: pointer;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1;
    display: none;
    z-index: 1;
    min-width: auto !important;
    width: auto !important;
    height: auto !important;
}

.search-clear-btn:hover {
    color: #333 !important;
    background: none !important;
}


/* Search form large (search page) */
.search-form-large {
    display: flex;
    gap: 0.5rem;
    max-width: 500px;
    margin-bottom: 1.5rem;
}

.search-form-large .search-input-wrapper {
    flex: 1;
}

.search-form-large .search-input-wrapper input {
    font-size: 1rem;
    padding: 0.625rem 2rem 0.625rem 0.75rem;
}

/* Filter form - keep on one line */
.filter-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
}

.filter-form .search-input-wrapper {
    flex: 0 0 250px;
}

/* Header search (if applicable) */
.page-header .search-input-wrapper,
.site-header .search-input-wrapper,
header .search-input-wrapper {
    flex: 0 1 200px;
}

.page-header .search-input-wrapper input,
.site-header .search-input-wrapper input,
header .search-input-wrapper input {
    font-size: 0.875rem;
    padding: 0.375rem 1.75rem 0.375rem 0.5rem;
}

.page-header .search-clear-btn,
.site-header .search-clear-btn,
header .search-clear-btn {
    right: 0.375rem;
    font-size: 1rem;
}

/* Tip text */
.search-tip {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #666;
}

.search-tip code {
    background: #f5f5f5;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

/* Header search form */
.search-form {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.search-form .search-input-wrapper {
    flex: 0 1 180px;
}

.search-form .search-input-wrapper input {
    font-size: 0.875rem;
    padding: 0.375rem 1.75rem 0.375rem 0.5rem;
}

.search-form .search-clear-btn {
    right: 0.375rem;
    font-size: 1rem;
}