/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Error page specific styles */
.error-container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.error-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

.error-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.error-message {
    font-size: 1.2rem;
    color: #718096;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    min-width: 120px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.error-help {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.error-help p {
    color: #a0aec0;
    font-size: 0.9rem;
}

/* Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* General site styles */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    text-decoration: none;
}

/* Search container */
.search-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 1rem;
    min-width: 300px;
    transition: all 0.3s ease;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input::placeholder {
    color: #a0aec0;
}

/* Hero section */
.hero {
    padding: 4rem 0;
    text-align: center;
    color: white;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.search-example {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-example p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin: 0;
}

/* Gallery section */
.gallery {
    padding: 3rem 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    min-height: 400px;
}

.gallery-header {
    text-align: center;
    margin-bottom: 2rem;
}

.gallery-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 1rem;
}

.gallery-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
    color: #718096;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.gallery-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.selected-count {
    background: #667eea;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

/* Gallery form */
.gallery-form {
    margin-top: 2rem;
}

.form-actions {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.form-help {
    color: #718096;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Loading spinner */
.loading-spinner {
    text-align: center;
    padding: 3rem 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #718096;
    font-size: 1.1rem;
}

/* Error message */
.error-message {
    text-align: center;
    padding: 3rem 0;
}

.error-message .error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-message h3 {
    font-size: 1.5rem;
    color: #e53e3e;
    margin-bottom: 1rem;
}

.error-message p {
    color: #718096;
}

/* Gallery grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.gallery-item.selected {
    border: 3px solid #667eea;
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-info {
    padding: 1rem;
}

.gallery-item-title {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-item-meta {
    font-size: 0.8rem;
    color: #718096;
}

/* Checkbox styling */
.gallery-item-checkbox {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 24px;
    height: 24px;
    border: 2px solid #667eea;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.gallery-item-checkbox:checked {
    background: #667eea;
    border-color: #667eea;
}

.gallery-item-checkbox:checked::after {
    content: '✓';
    color: white;
    font-size: 16px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.gallery-item-checkbox:hover {
    transform: scale(1.1);
}

/* No results */
.no-results {
    text-align: center;
    padding: 3rem 0;
    color: #718096;
}

/* Results section */
.results {
    padding: 3rem 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    min-height: 400px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
}

.results-content {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Success and error messages in results */
.success-message {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.success-message h3 {
    color: #22543d;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.success-message p {
    color: #2f855a;
    margin: 0;
}

.results-details {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.results-details h4 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.results-details ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.results-details li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
    color: #4a5568;
}

.results-details li:last-child {
    border-bottom: none;
}

.results-details strong {
    color: #2d3748;
}

.api-message {
    background: #f0f9ff;
    border: 1px solid #93c5fd;
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
}

.api-message p {
    color: #1e40af;
    margin: 0;
}

.api-message strong {
    color: #1e3a8a;
}

/* Image Modal */
.image-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    margin: 2% auto;
    padding: 20px;
    width: 90%;
    max-width: 800px;
    text-align: center;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
    z-index: 1001;
}

.close-modal:hover,
.close-modal:focus {
    color: white;
}

#modalImage {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-info {
    margin-top: 1rem;
    color: white;
    text-align: left;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.modal-info h3 {
    margin-bottom: 0.5rem;
    color: white;
}

.modal-info p {
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

/* Footer */
footer {
    background: rgba(0, 0, 0, 0.1);
    color: white;
    text-align: center;
    padding: 2rem 0;
    backdrop-filter: blur(10px);
}

footer p {
    opacity: 0.8;
}

/* Utility classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .search-container {
        flex-direction: column;
        width: 100%;
    }
    
    .search-input {
        min-width: auto;
        width: 100%;
    }
    
    .nav {
        flex-direction: column;
        align-items: stretch;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .gallery-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .gallery-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .results-header {
        flex-direction: column;
        text-align: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
}

/* Download section styles */
.download-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.download-section h4 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.download-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.download-info p {
    color: white;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.download-info p:last-child {
    margin-bottom: 0;
}

.download-actions {
    text-align: center;
}

.download-btn {
    display: inline-block;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.download-note {
    color: #ffd700;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    opacity: 0.9;
}

/* Success message enhancement */
.success-message {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.success-message h3 {
    color: #4caf50;
    margin-bottom: 0.5rem;
}

.success-message p {
    color: white;
    opacity: 0.9;
}

/* Password Authentication Modal */
.password-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.password-modal-content {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.password-modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.password-modal-header h2 {
    font-size: 1.8rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.password-modal-header p {
    color: #718096;
    font-size: 1rem;
    line-height: 1.5;
}

.password-form {
    width: 100%;
}

.password-input-group {
    margin-bottom: 1.5rem;
}

.password-input-group label {
    display: block;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.password-input-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.password-input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.password-error {
    margin-top: 0.5rem;
    color: #e53e3e;
    font-size: 0.875rem;
    font-weight: 500;
}

.password-form-actions {
    display: flex;
    justify-content: center;
}

.password-form-actions .btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}