/**
 * Vina Search Bar Styles
 * Styling for the search bar shortcode
 */

/* Search Container */
.vina-search-container {
    max-width: 800px;
    width: 600px;
    margin: 0 auto;
    position: relative;
    animation: fadeInUp 0.6s ease-out;
}

/* Search Bar Wrapper */
.search-bar-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    padding: 8px 10px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

/* Toggle Buttons */
.search-toggle-buttons {
    display: flex;
    gap: 10px;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border: 1px solid #838383;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    color: #838383;
}

.toggle-btn.active {
    background: var(--color-secondary);
    color: white;
    border-color: var(--color-secondary);
}

.toggle-btn:hover:not(.active) {
    background: #e9ecef;
    color: #838383;
}

.toggle-text {
    font-weight: 500;
    font-size: 20px;
    line-height: 18px;
    letter-spacing: 1px;
}

.toggle-icon {
    width: 16px;
    height: 16px;
}

.toggle-btn:not(.active) .toggle-icon {
    color: #6c757d;
}

.toggle-btn.active .toggle-icon {
    color: white;
}

/* Checkmark Icon Styles */
.checkmark-icon {
    transition: filter 0.3s ease;
    display: block;
}

/* Icon màu xám khi button không active */
.toggle-btn:not(.active) .checkmark-icon {
    filter: brightness(0) saturate(100%) invert(50%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
    opacity: 0.6;
}

/* Icon màu trắng khi button active */
.toggle-btn.active .checkmark-icon {
    filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
    opacity: 1;
}

/* Search Input */
.search-input-wrapper {
    flex: 1;
    margin-right: 16px;
}

.search-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 12px 16px;
    font-weight: 700;
    background: transparent;
    color: #838383;
}

.search-input::placeholder {
    color: #838383;
    font-weight: 700;
}

/* Search Button */
.search-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--color-secondary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.search-btn:hover {
    background: var(--color-accent);
    transform: scale(1.05);
}

/* Trade Now Button */
.trade-now-wrapper {
    display: flex;
    justify-content: end;
}

.trade-now-btn {
    display: inline-block;
    padding: 16px 40px;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 20px;
    line-height: 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 141, 82, 0.3);
    margin-right: 80px;
}

.trade-now-btn:hover {
    background: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 141, 82, 0.4);
    color: white;
    text-decoration: none;
}

/* ==========================================================================
   Mobile Search Wrapper Styles
   ========================================================================== */

/* Mobile Search Wrapper */
.mobile-search-wrapper {
    display: none;
    background: white;
    border-top: 1px solid #e9ecef;
}

.mobile-search-wrapper .vina-search-container {
    max-width: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0 0;
}

.mobile-search-wrapper .search-bar-wrapper {
    flex-direction: row;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.mobile-search-wrapper .search-toggle-buttons {
    display: flex;
    gap: 4px;
    margin-right: 8px;
    width: auto;
}

.mobile-search-wrapper .toggle-btn {
    padding: 8px 16px;
    flex: 0 0 auto;
}

.mobile-search-wrapper .toggle-text {
    font-size: 14px;
    font-weight: 600;
}

.mobile-search-wrapper .toggle-btn svg {
    display: none;
}

.mobile-search-wrapper .checkmark-icon {
    display: none;
}

.mobile-search-wrapper .search-input-wrapper {
    flex: 1;
    margin-right: 8px;
    margin-bottom: 0;
    width: auto;
}

.mobile-search-wrapper .search-input {
    text-align: left;
    font-size: 14px;
    padding: 8px 12px;
}

.mobile-search-wrapper .search-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}


.mobile-search-wrapper .trade-now-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: 0;
    flex-shrink: 0;
}

.mobile-search-wrapper .trade-now-btn {
    padding: 12px 24px;
    font-size: 16px;
    margin-right: 0;
    white-space: nowrap;
    position: relative;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1024px) {
    /* Hide text initially on mobile to prevent flash, JS will process and show */
    .mobile-search-wrapper .trade-now-btn .trade-now-text {
        opacity: 0;
        transition: opacity 0.1s ease;
    }
    
    .mobile-search-wrapper .trade-now-btn .trade-now-text.processed {
        opacity: 1;
    }
    
    .vina-search-container {
        display: none;
    }
    
    /* Show mobile search wrapper */
    .mobile-search-wrapper {
        display: block;
    }
    
    /* Show search bar when inside mobile header */
    .search-bar-wrapper {
        padding: 10px 0 12px;
        border-radius: 40px;
        box-shadow: none;
        border: 1px solid #D9D9D9;
        margin-bottom: 0;
    }
    
    .search-toggle-buttons {
        width: 100%;
        justify-content: center;
        margin-right: 0;
    }
    
    .toggle-btn {
        flex: 1;
        justify-content: center;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    /* Ẩn icon checkmark trên mobile */
    .checkmark-icon {
        display: none;
    }
    
    .search-input-wrapper {
        width: 100%;
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .search-input {
        text-align: center;
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .search-btn {
        width: 100%;
        height: 50px;
        border-radius: 24px;
    }
    
    .trade-now-btn {
        padding: 12px 25px;
        font-size: 14px;
    }
    
    /* Mobile search wrapper adjustments */
    .mobile-search-wrapper .search-toggle-buttons {
        justify-content: center;
        margin-right: 0;
    }
    
    .mobile-search-wrapper .toggle-btn {
        padding: 8px 12px;
    }
    
    .mobile-search-wrapper .toggle-text {
        font-size: 14px;
    }
    
    .mobile-search-wrapper .search-input-wrapper {
        width: 100%;
        margin-right: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .mobile-search-wrapper .search-input {
        font-size: 14px;
        padding: 8px 10px;
    }
    
    .mobile-search-wrapper .search-btn {
        width: 36px;
        height: 36px;
    }
    
    .mobile-search-wrapper .search-bar-wrapper {
        padding: 4px;
        width: 100%;
        flex: 1 1 100%;
    }
    
    .mobile-search-wrapper .trade-now-btn {
        padding: 10px 18px;
        font-size: 14px;
        line-height: 24px;
    }
}

/* Animation Effects */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus States for Accessibility */
.toggle-btn:focus,
.search-btn:focus,
.trade-now-btn:focus {
    outline: 2px solid #108D52;
    outline-offset: 2px;
}

.search-input:focus {
    outline: none;
}

/* Loading State */
.search-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.search-btn.loading .search-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success State */
.search-btn.success {
    background: #28a745;
}

.search-btn.success:hover {
    background: #218838;
}
