/* ==========================================
   style.css - Google Search API System
   រចនាបទសម្រាប់ប្រព័ន្ធស្វែងរក
   ========================================== */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Khmer', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a2980, #26d0ce);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loader {
    text-align: center;
    color: white;
}

.search-icon-animated {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: searchPulse 2s infinite;
}

@keyframes searchPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.loader p {
    font-size: 1.2rem;
    margin-top: 10px;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.8s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.search-header {
    background: linear-gradient(135deg, #4285f4, #34a853, #fbbc05, #ea4335);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    padding: 25px 40px;
    border-radius: 20px;
    margin-bottom: 30px;
    color: white;
    box-shadow: 0 10px 30px rgba(66, 133, 244, 0.3);
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo-section {
    flex: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 50%;
}

.logo h1 {
    font-size: 2.2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-left: 70px;
}

.api-status {
    display: flex;
    gap: 25px;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.status-indicator i {
    color: #4CAF50;
    font-size: 0.8rem;
}

.search-count {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.search-count i {
    color: #FFC107;
}

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

.search-container h2 {
    color: #4285f4;
    margin-bottom: 25px;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    margin-bottom: 30px;
}

.search-input-group {
    position: relative;
    margin-bottom: 25px;
}

#searchQuery {
    width: 100%;
    padding: 18px 25px;
    font-size: 1.2rem;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Noto Sans Khmer', sans-serif;
}

#searchQuery:focus {
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.search-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.search-btn, .image-search-btn, .voice-search-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Noto Sans Khmer', sans-serif;
}

.search-btn {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    flex: 2;
}

.search-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(66, 133, 244, 0.3);
}

.image-search-btn {
    background: linear-gradient(135deg, #fbbc05, #ea4335);
    color: white;
    flex: 1;
}

.image-search-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(251, 188, 5, 0.3);
}

.voice-search-btn {
    background: #f5f5f5;
    color: #333;
    width: 60px;
    justify-content: center;
}

.voice-search-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-top: 25px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-group label {
    color: #4285f4;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group select {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-family: 'Noto Sans Khmer', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #4285f4;
}

.quick-search {
    margin-top: 30px;
}

.quick-search h3 {
    color: #666;
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quick-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-tag {
    padding: 10px 20px;
    background: #e8f0fe;
    border: 1px solid #d2e3fc;
    border-radius: 50px;
    color: #4285f4;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.quick-tag:hover {
    background: #4285f4;
    color: white;
    transform: translateY(-2px);
}

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

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.results-header h2 {
    color: #4285f4;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-stats {
    display: flex;
    gap: 20px;
    color: #666;
    font-size: 1rem;
}

.search-results {
    min-height: 300px;
}

.empty-results {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-icon {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-results h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #666;
}

/* Image Results */
.image-results-section {
    background: white;
    padding: 40px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
    color: #4285f4;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.back-btn {
    padding: 12px 25px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 50px;
    color: #4285f4;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Noto Sans Khmer', sans-serif;
}

.back-btn:hover {
    background: #4285f4;
    color: white;
}

.image-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 0;
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

.modal-header {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #fbbc05;
}

.modal-body {
    padding: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: #4285f4;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Noto Sans Khmer', sans-serif;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #4285f4;
}

.form-hint {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9rem;
}

.api-test {
    margin-top: 30px;
}

.test-btn {
    padding: 15px 25px;
    background: #34a853;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.3s ease;
}

.test-btn:hover {
    background: #2e8b47;
}

.test-result {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    display: none;
}

.test-result.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

.test-result.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

.modal-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

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

.save-btn {
    background: #4285f4;
    color: white;
}

.save-btn:hover {
    background: #3367d6;
    transform: translateY(-2px);
}

.reset-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    color: #666;
}

.reset-btn:hover {
    background: #e9ecef;
}

/* Footer */
.search-footer {
    background: linear-gradient(135deg, #2c3e50, #4a6491);
    color: white;
    padding: 40px;
    border-radius: 20px;
    margin-top: 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-section p {
    opacity: 0.9;
    line-height: 1.6;
}

.config-btn {
    padding: 12px 25px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Noto Sans Khmer', sans-serif;
}

.config-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.copyright {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.8;
    font-size: 0.9rem;
}

.api-credit {
    margin-top: 10px;
    color: #fbbc05;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.page-btn {
    padding: 12px 25px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #4285f4;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Noto Sans Khmer', sans-serif;
}

.page-btn:hover:not(:disabled) {
    background: #4285f4;
    color: white;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-numbers {
    font-size: 1.1rem;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-container {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .logo {
        justify-content: center;
    }
    
    .tagline {
        margin-left: 0;
    }
    
    .api-status {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .search-section,
    .results-section,
    .image-results-section {
        padding: 25px;
    }
    
    .search-buttons {
        flex-direction: column;
    }
    
    .search-btn,
    .image-search-btn {
        width: 100%;
    }
    
    .results-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .search-filters {
        grid-template-columns: 1fr;
    }
    
    .quick-tags {
        justify-content: center;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .save-btn,
    .reset-btn {
        width: 100%;
        justify-content: center;
    }
}
