/**
 * Search Post Styles
 * Creates a modern, exciting search interface with Rosso Corsa red theme
 */

 :root {
    --rosso-corsa: #d40000; /* Rosso Corsa red */
    --rosso-corsa-dark: #b50000;
    --rosso-corsa-light: #ff1a1a;
    --text-light: #ffffff;
    --text-dark: #333333;
    --bg-light: #ffffff;
    --bg-dark: #333333;
    --transition-speed: 0.3s;
}

/* Hide body scrollbar when search is active */
body.search-post-active {
    overflow: hidden;
}

/* Search container */
.search-post-container {
    display: inline-block;
    position: relative;
}

/* Search icon button */
.search-post-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    position: relative;
    z-index: 1;
    padding: 0;
    margin: 0;
}

.search-post-icon:hover {
    transform: scale(1.05);
}

.search-post-icon:active {
    transform: scale(0.95);
}

.search-post-icon svg {
    fill: rgba(0, 0, 0, 0.75);
    width: 20px;
    height: 20px;
    transition: all var(--transition-speed) ease;
}

.search-post-icon:hover svg,
.search-post-icon:active svg,
.search-post-icon:visited svg {
    fill: rgba(0, 0, 0, 0.75);
}

/* Search overlay */
.search-post-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed) ease;
}

.search-post-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Search modal */
.search-post-modal {
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background-color: var(--bg-light);
    border-radius: 8px;
    padding: 30px;
    transform: translateY(30px);
    opacity: 0;
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.search-post-modal.active {
    transform: translateY(0);
    opacity: 1;
}

/* Close button */
.search-post-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all var(--transition-speed) ease;
    padding: 0;
}

.search-post-close:hover {
    transform: rotate(90deg);
}

.search-post-close:active {
    transform: rotate(90deg) scale(0.95);
}

.search-post-close svg {
    fill: rgba(0, 0, 0, 0.75);
    width: 20px;
    height: 20px;
    transition: all var(--transition-speed) ease;
}

.search-post-close:hover svg,
.search-post-close:active svg,
.search-post-close:visited svg {
    fill: rgba(0, 0, 0, 0.75);
}

/* Search form */
.search-post-form {
    margin-bottom: 25px;
    position: relative;
}

.search-post-input {
    width: 100%;
    height: 60px;
    font-size: 24px;
    border: none;
    border-bottom: 3px solid var(--rosso-corsa);
    padding: 0 45px 0 0;
    background-color: transparent;
    color: var(--text-dark);
    outline: none;
    transition: all var(--transition-speed) ease;
    box-sizing: border-box;
}

.search-post-input:focus {
    border-bottom-color: var(--rosso-corsa-dark);
}

.search-post-input::placeholder {
    color: rgba(51, 51, 51, 0.5);
}

/* Search results area */
.search-post-results {
    overflow-y: auto;
    max-height: calc(80vh - 120px);
    padding-right: 10px;
    margin-bottom: 20px;
}

.search-post-results::-webkit-scrollbar {
    width: 6px;
}

.search-post-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.search-post-results::-webkit-scrollbar-thumb {
    background: var(--rosso-corsa);
    border-radius: 3px;
}

.search-post-results::-webkit-scrollbar-thumb:hover {
    background: var(--rosso-corsa-dark);
}

/* Search results count */
.search-post-results-count {
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--text-dark);
    font-weight: 500;
}

/* Search results list */
.search-post-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Search result item */
.search-post-result-item {
    margin-bottom: 15px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all var(--transition-speed) ease;
    background-color: #fff;
}

.search-post-result-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(212, 0, 0, 0.2);
}

.search-post-result-link {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    text-decoration: none;
    color: var(--text-dark);
}

/* Result thumbnail */
.search-post-result-thumbnail {
    flex: 0 0 100px;
    height: 100px;
    margin-right: 15px;
    border-radius: 4px;
    overflow: hidden;
}

.search-post-result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Result content */
.search-post-result-content {
    flex: 1;
    min-width: 0; /* Prevents text overflow */
}

.search-post-result-type {
    display: inline-block;
    padding: 3px 6px;
    background-color: var(--rosso-corsa);
    color: var(--text-light);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 3px;
    margin-bottom: 8px;
}

.search-post-result-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    transition: all var(--transition-speed) ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-post-result-link:hover .search-post-result-title {
    color: var(--rosso-corsa);
}

.search-post-result-excerpt {
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-dark);
    opacity: 0.8;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-post-result-date {
    font-size: 12px;
    color: var(--text-dark);
    opacity: 0.6;
}

/* Loading indicator */
.search-post-loading {
    display: none;
    text-align: center;
    padding: 20px 0;
}

.search-post-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(212, 0, 0, 0.1);
    border-top-color: var(--rosso-corsa);
    animation: spin 1s infinite linear;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* No results message */
.search-post-no-results {
    display: none;
    text-align: center;
    padding: 20px 0;
    color: var(--text-dark);
}

.search-post-no-results p {
    font-size: 16px;
    opacity: 0.7;
    margin: 0;
}

/* Responsive styles */
@media (max-width: 768px) {
    .search-post-modal {
        padding: 20px;
        width: 95%;
    }
    
    .search-post-input {
        font-size: 20px;
        height: 50px;
    }
    
    .search-post-result-link {
        flex-direction: column;
    }
    
    .search-post-result-thumbnail {
        width: 100%;
        flex: 0 0 auto;
        margin-right: 0;
        margin-bottom: 10px;
        height: 150px;
    }
}

/* Animation for entrance */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-post-results-list li {
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
}

.search-post-results-list li:nth-child(1) { animation-delay: 0.05s; }
.search-post-results-list li:nth-child(2) { animation-delay: 0.1s; }
.search-post-results-list li:nth-child(3) { animation-delay: 0.15s; }
.search-post-results-list li:nth-child(4) { animation-delay: 0.2s; }
.search-post-results-list li:nth-child(5) { animation-delay: 0.25s; }
.search-post-results-list li:nth-child(6) { animation-delay: 0.3s; }
.search-post-results-list li:nth-child(7) { animation-delay: 0.35s; }
.search-post-results-list li:nth-child(8) { animation-delay: 0.4s; }
.search-post-results-list li:nth-child(9) { animation-delay: 0.45s; }
.search-post-results-list li:nth-child(10) { animation-delay: 0.5s; }