/* styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #547c38;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 20px;
    color: #ffffff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* Admin Controls */
.admin-controls {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 100;
}

.admin-btn {
    background-color: rgba(255,255,255,0.2);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.admin-btn:hover {
    background-color: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.admin-status {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(255,255,255,0.15);
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.3);
}

#admin-username {
    font-size: 0.9em;
    color: #e8f5e9;
}

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

.modal-content {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
    color: #333;
}

.modal-content h2 {
    color: #3d5a2a;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #3d5a2a;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.form-group input:focus {
    outline: none;
    border-color: #547c38;
    box-shadow: 0 0 0 2px rgba(84,124,56,0.2);
}

.login-error {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 0.9em;
    border: 1px solid #ef9a9a;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #547c38;
    color: white;
}

.btn-primary:hover {
    background-color: #3d5a2a;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

/* Delete Button in Table */
.delete-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.3s ease;
}

.delete-btn:hover {
    background-color: #d32f2f;
}

.actions-cell {
    text-align: center;
    width: 100px;
}

.actions-header {
    width: 100px;
    text-align: center;
    display: none; /* Hidden by default, shown when admin logs in */
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    text-align: center;
    color: #e8f5e9;
    margin-bottom: 30px;
    font-size: 1.2em;
}

.stats {
    background-color: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.stats h2 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.stat-box {
    background-color: rgba(255,255,255,0.15);
    padding: 15px;
    border-radius: 8px;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #ffeb3b;
}

.stat-label {
    color: #e8f5e9;
    font-size: 0.9em;
    margin-top: 5px;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2em;
    color: #e8f5e9;
}

.error {
    background-color: rgba(244, 67, 54, 0.2);
    border: 2px solid #f44336;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.table-container {
    background-color: rgba(255,255,255,0.95);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    color: #333;
}

thead {
    background-color: #3d5a2a;
    color: white;
}

th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #547c38;
}

td {
    padding: 12px 10px;
    border-bottom: 1px solid #ddd;
}

tbody tr:hover {
    background-color: #f5f5f5;
}

tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.confidence {
    font-weight: bold;
}

.confidence-high {
    color: #4caf50;
}

.confidence-medium {
    color: #ff9800;
}

.confidence-low {
    color: #f44336;
}

.scientific-name {
    font-style: italic;
    color: #666;
    font-size: 0.9em;
}

.top-predictions {
    font-size: 0.85em;
    color: #777;
    margin-top: 5px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1em;
}

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

    .table-container {
        padding: 10px;
    }

    th, td {
        padding: 8px 5px;
        font-size: 0.9em;
    }

    .top-predictions {
        display: none;
    }
}

/* ============================================================
   IMAGE PREVIEW (table column)
   ============================================================ */
.image-preview-cell {
    padding: 8px 10px;
    vertical-align: middle;
    text-align: center;
    min-width: 140px;
}

.sighting-thumbnail {
    width: auto;
    max-width: 280px;
    display: block;
    margin: 0 auto;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sighting-thumbnail:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 14px rgba(0,0,0,0.28);
}

.no-image-text {
    color: #aaa;
    font-size: 0.85em;
    font-style: italic;
}

/* ============================================================
   BIRD DETAIL MODAL
   ============================================================ */
.bird-modal-content {
    max-width: 600px;
    width: 94%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    border-radius: 12px;
    position: relative;
}

.bird-modal-close {
    position: sticky;
    top: 10px;
    float: right;
    margin: 10px 10px 0 0;
    background: none;
    border: none;
    font-size: 1.8em;
    line-height: 1;
    color: #666;
    cursor: pointer;
    z-index: 10;
    padding: 0 6px;
    border-radius: 50%;
    transition: background 0.2s;
}

.bird-modal-close:hover {
    background: rgba(0,0,0,0.08);
    color: #333;
}

.bird-modal-image-wrap {
    width: 100%;
    background: #1a1a1a;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bird-modal-img {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    display: block;
}

.bird-modal-no-img {
    color: #888;
    font-style: italic;
    padding: 40px 20px;
    text-align: center;
    font-size: 1em;
}

.bird-modal-common {
    color: #3d5a2a;
    margin: 18px 22px 4px;
    font-size: 1.7em;
}

.bird-modal-scientific {
    font-style: italic;
    color: #666;
    margin: 0 22px 10px;
    font-size: 1em;
}

.bird-modal-meta {
    margin: 0 22px 16px;
    font-size: 0.92em;
    color: #444;
}

.bird-modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin: 0 0 18px;
}

.bird-stat-box {
    padding: 14px 10px;
    text-align: center;
    border-right: 1px solid #eee;
}

.bird-stat-box:last-child {
    border-right: none;
}

.bird-stat-num {
    font-size: 1.9em;
    font-weight: bold;
    color: #547c38;
}

.bird-stat-label {
    font-size: 0.78em;
    color: #888;
    margin-top: 3px;
}

.bird-modal-predictions-wrap {
    margin: 0 22px 16px;
}

.bird-modal-predictions-wrap h3 {
    font-size: 1em;
    color: #3d5a2a;
    margin-bottom: 8px;
}

.bird-modal-predictions-wrap ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bird-modal-predictions-wrap ul li {
    font-size: 0.88em;
    color: #555;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

.bird-modal-predictions-wrap ul li:last-child {
    border-bottom: none;
}

.bird-modal-ebird-wrap {
    margin: 0 22px 22px;
    text-align: center;
}

.bird-modal-ebird-wrap a {
    display: inline-block;
    color: #547c38;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95em;
    padding: 8px 16px;
    border: 2px solid #547c38;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.bird-modal-ebird-wrap a:hover {
    background: #547c38;
    color: white;
}

#sightings-table tbody tr:hover {
    background-color: #edf5e8 !important;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 4px;
}

#pagination-top .pagination {
    border-bottom: 1px solid #ddd;
    margin-bottom: 12px;
}

#pagination-bottom .pagination {
    border-top: 1px solid #ddd;
    margin-top: 12px;
}

.page-btn {
    background-color: #ffffff;
    color: #3d5a2a;
    border: 1px solid #b0c9a0;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 36px;
    text-align: center;
}

.page-btn:hover:not([disabled]) {
    background-color: #547c38;
    color: #ffffff;
    border-color: #547c38;
}

.page-btn.page-active {
    background-color: #3d5a2a;
    color: #ffffff;
    border-color: #3d5a2a;
    font-weight: 700;
    cursor: default;
}

.page-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

.page-ellipsis {
    color: #888;
    padding: 0 4px;
    font-size: 1em;
    user-select: none;
}

.page-info {
    margin-left: auto;
    font-size: 0.85em;
    color: #666;
    white-space: nowrap;
}