/* TinyBirdiary Styles */

:root {
    --primary-color: #2e7d32;
    --primary-light: #60ad5e;
    --primary-dark: #005005;
    --secondary-color: #1976d2;
    --background: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

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

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.subtitle {
    opacity: 0.9;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 1.5s infinite;
}

.status-dot.connected {
    background: var(--success);
    animation: none;
}

.status-dot.disconnected {
    background: var(--error);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Content */
main {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
    min-width: 120px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Filters */
.filters {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-group select,
.filter-group input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 150px;
}

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

.confidence-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.confidence-input input[type="range"] {
    width: 100px;
    accent-color: var(--primary-color);
}

.confidence-input span {
    min-width: 35px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

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

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

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #ccc;
}

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

.btn-danger:hover {
    background: #c62828;
}

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.sighting-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.sighting-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.sighting-card.new {
    animation: highlight 2s ease-out;
}

@keyframes highlight {
    0% { box-shadow: 0 0 0 4px var(--success); }
    100% { box-shadow: var(--shadow); }
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #eee;
}

.sighting-card.recording .card-image {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    animation: recording-pulse 2s ease-in-out infinite;
}

@keyframes recording-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.card-info {
    padding: 1rem;
}

.bird-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.box-badge {
    display: inline-block;
    background: var(--primary-light);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: auto;
}

.confidence-badge {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.confidence-badge.large {
    font-size: 0.9rem;
    padding: 0.2rem 0.6rem;
}

.image-count {
    color: var(--primary-color);
}

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

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

.pagination button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-hover);
    border-left: 4px solid var(--success);
    animation: slideIn 0.3s ease-out;
    max-width: 350px;
}

.toast.info {
    border-left-color: var(--secondary-color);
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    margin: 1rem;
}

.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--border-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-gif-link {
    display: block;
    cursor: pointer;
    position: relative;
}

.modal-gif-link:hover .modal-gif {
    opacity: 0.9;
}

.modal-gif-link::after {
    content: '⬇️ Click to download';
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.modal-gif-link:hover::after {
    opacity: 1;
}

.modal-gif {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: opacity 0.2s;
}

.modal-details h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-details p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.image-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.image-thumbnails img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.image-thumbnails img:hover {
    transform: scale(1.1);
}

.modal-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

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

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

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

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .stats-bar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filters {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
    }

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

/* Empty state */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    max-width: 400px;
    margin: 0 auto;
}
