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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7f7fd5 100%);
    min-height: 100vh;
    color: #333;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.03)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.subtitle {
    font-size: 0.9rem;
    font-style: italic;
    opacity: 0.8;
    margin-top: 10px;
    line-height: 1.4;
}



/* Battle Section */
.battle-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.battle-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 2rem;
}

.battle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}

.bird-card {
    flex: 1;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 3px solid transparent;
    cursor: pointer;
}

.bird-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.bird-card.selected {
    border-color: #28a745;
    background: #d4edda;
}

.bird-image-container {
    position: relative;
    width: 100%;
    height: 300px;
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
    background: #e9ecef;
}

.bird-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: #6c757d;
}

.bird-card h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
}

.vote-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.vote-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.vote-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* VS Section */
.vs-section {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 100px;
}

.vs-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

/* Battle Feedback */
.battle-feedback {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-top: 20px;
}

.battle-feedback h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #495057;
}

.feedback-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.feedback-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-btn.thumbs-up {
    background: #28a745;
    color: white;
}

.feedback-btn.thumbs-down {
    background: #dc3545;
    color: white;
}

.feedback-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.comment-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-top: 20px;
}

.comment-section textarea {
    width: 100%;
    height: 100px;
    padding: 15px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
}

.comment-section textarea:focus {
    outline: none;
    border-color: #667eea;
}

.comment-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.comment-section button {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.next-btn {
    background: #28a745 !important;
}

.comment-section button:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.next-btn:hover {
    background: #218838 !important;
}

/* Leaderboard Section */
.leaderboard-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.leaderboard-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 2rem;
}

/* Podium */
.podium {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    height: 200px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.podium-bird {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.podium-bird:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.podium-bird img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.podium-place.first .podium-bird {
    border-color: #ffd700;
    height: 150px;
    width: 150px;
}

.podium-place.second .podium-bird {
    border-color: #c0c0c0;
    height: 130px;
    width: 130px;
}

.podium-place.third .podium-bird {
    border-color: #cd7f32;
    height: 110px;
    width: 110px;
}

.place-number {
    position: absolute;
    bottom: -10px;
    right: -10px;
    background: #333;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.podium-bird {
    position: relative;
}

.podium-bird::after {
    content: attr(data-wins);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.podium-place::after {
    content: attr(data-place);
    position: absolute;
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    border: 2px solid rgba(255,255,255,0.2);
}

/* Comments Section */
.comments-section {
    margin-bottom: 30px;
}

.comments-section h3 {
    margin-bottom: 20px;
    color: #495057;
}

.comment-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: transform 0.2s ease;
}

.comment-item:hover {
    transform: translateX(5px);
}

.comment-content {
    flex: 1;
}

.comment-text {
    margin-bottom: 8px;
    color: #495057;
    line-height: 1.4;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #6c757d;
    font-size: 0.9rem;
}

.comment-bird {
    font-weight: 600;
    color: #667eea;
}

.comment-votes {
    transition: color 0.2s ease;
}

.comment-votes:hover {
    color: #28a745;
}

.comment-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.pagination-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination-btn:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-info {
    color: #6c757d;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Top List */
.top-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.top-list-header h3 {
    margin-bottom: 0;
    color: #495057;
}

/* Top Birds Pagination */
.top-birds-pagination {
    margin-top: 20px;
}

.top-birds-pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.battle-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: transform 0.2s ease;
    cursor: pointer;
    position: relative;
}

.battle-item:hover {
    transform: translateX(5px);
    background: #e9ecef;
}

.battle-item .rank-number {
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    border: 2px solid rgba(255,255,255,0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.battle-item:hover .rank-number {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.battle-item img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
}

.battle-info {
    flex: 1;
}

.battle-info h4 {
    margin-bottom: 5px;
    color: #495057;
}

.battle-stats {
    color: #6c757d;
    font-size: 0.9rem;
}

.comment-voting {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.vote-btn-comment {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
}

.vote-btn-comment:hover {
    background-color: #e9ecef;
}

.vote-btn-comment.upvoted {
    color: #28a745;
}

.vote-btn-comment.downvoted {
    color: #dc3545;
}

.vote-count {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Image Manager */
.image-manager-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.image-manager-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 2rem;
}

.image-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.download-btn, .clear-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-btn {
    background: #28a745;
    color: white;
}

.clear-btn {
    background: #dc3545;
    color: white;
}

.download-btn:hover, .clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.image-stats {
    text-align: center;
    color: #6c757d;
}

.image-stats p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.image-stats span {
    font-weight: 600;
    color: #495057;
}

/* Responsive Design */
@media (max-width: 768px) {
    .battle-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .vs-section {
        flex: none;
        order: 0;
        margin: 10px 0;
    }
    
    .vs-circle {
        width: 60px;
        height: 60px;
        font-size: 1.2rem;
    }
    
    .podium {
        height: 150px;
        gap: 10px;
    }
    
    .podium-place.first .podium-bird {
        height: 100px;
        width: 100px;
    }
    
    .podium-place.second .podium-bird {
        height: 80px;
        width: 80px;
    }
    
    .podium-place.third .podium-bird {
        height: 60px;
        width: 60px;
    }
    
    .image-controls {
        flex-direction: column;
        align-items: center;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    /* Comments mobile styles */
    .comments-section {
        margin-top: 70px;
    }
    
    .comment-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .comment-item {
        padding: 12px;
    }
    
    .comment-text {
        font-size: 0.95rem;
    }
    
    .comment-meta {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .battle-section, .leaderboard-section, .image-manager-section {
        padding: 20px;
    }
    
    .feedback-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    /* Comments mobile styles for very small screens */
    .comment-item {
        padding: 10px;
    }
    
    .comment-text {
        font-size: 0.9rem;
    }
    
    .comment-meta {
        font-size: 0.8rem;
        gap: 6px;
    }
    
    .comment-pagination {
        flex-direction: column;
        gap: 10px;
    }
    
    .pagination-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* Image Popup Modal */
.image-popup {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.popup-content {
    position: relative;
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
}

.close-popup {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 1;
}

.close-popup:hover {
    color: #333;
}

#popup-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 15px;
    margin-bottom: 20px;
}

#popup-title {
    text-align: center;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.5rem;
}

#popup-stats {
    text-align: center;
    color: #666;
    font-size: 1.1rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}
