/**
 * Amigurumi Recipes WordPress Plugin
 * Frontend Styles
 */

/* === Genel Yapı === */
.amigurumi-recipes-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* === Arama Bölümü === */
.amigurumi-search-section {
    margin-bottom: 30px;
}

.amigurumi-search-form {
    position: relative;
}

.search-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#amigurumi-search-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    outline: none;
    transition: all 0.3s;
}

#amigurumi-search-input:focus {
    border-color: #ff6b9d;
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.1);
}

.search-button {
    padding: 15px 30px;
    background: linear-gradient(135deg, #ff6b9d 0%, #c06c84 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.2s;
}

.search-button:hover {
    transform: scale(1.05);
}

/* Arama Önerileri */
.search-suggestions {
    margin-top: 15px;
}

.suggestions-title {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-tag {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.suggestion-tag:hover {
    background: #ff6b9d;
    color: white;
    border-color: #ff6b9d;
}

/* Arama Sonuçları */
.search-results {
    margin-top: 30px;
    padding: 30px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.results-header h3 {
    font-size: 20px;
    margin: 0;
    color: #333;
}

.close-search {
    background: #f5f5f5;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.close-search:hover {
    background: #ff6b9d;
    color: white;
    transform: rotate(90deg);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

/* === Filtreler === */
.amigurumi-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.filter-btn {
    padding: 12px 24px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.filter-btn:hover,
.filter-btn.active {
    background: linear-gradient(135deg, #ff6b9d 0%, #c06c84 100%);
    color: white;
    border-color: #ff6b9d;
}

/* === Tarif Grid === */
.amigurumi-recipes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 40px;
}

/* === Tarif Kartı === */
.amigurumi-recipe-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.amigurumi-recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.recipe-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f5f5f5;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.recipe-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    background: #f5f5f5;
}

.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    color: #999;
    font-size: 14px;
}

.recipe-rating {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.recipe-rating .stars {
    color: #ffd700;
}

.recipe-rating .rating-value {
    color: #333;
}

.recipe-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.recipe-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 15px 0;
    color: #333;
    line-height: 1.4;
    min-height: 48px;
}

.recipe-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #888;
}

.recipe-language {
    display: flex;
    align-items: center;
    gap: 5px;
}

.recipe-link {
    display: block;
    text-align: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, #ff6b9d 0%, #c06c84 100%);
    color: white !important;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s;
}

.recipe-link:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

/* === Pagination === */
.amigurumi-pagination {
    text-align: center;
    margin-top: 40px;
}

.load-more-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, #ff6b9d 0%, #c06c84 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}

.load-more-btn:hover {
    transform: scale(1.05);
}

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

.pagination-info {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

/* === Loading Spinner === */
.loading-spinner {
    text-align: center;
    padding: 40px;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 107, 157, 0.2);
    border-top-color: #ff6b9d;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Tek Tarif === */
.amigurumi-single-recipe {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Ana Container: Görsel + İçerik (Bootstrap Grid kullanılıyor) */
.recipe-main-container {
    margin-bottom: 40px;
}

/* Sol: Ana Görsel */
.recipe-image-main {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.recipe-image-main img {
    width: 100%;
    height: auto;
    display: block;
}

/* Sağ: İçerik */
.recipe-content-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.recipe-content-main .recipe-title {
    font-size: 32px;
    font-weight: 700;
    color: #222;
    margin: 0;
    line-height: 1.3;
}

.recipe-rating-large {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
}

.recipe-rating-large .rating-number {
    font-weight: 700;
    color: #ff6b9d;
    font-size: 28px;
}

.recipe-rating-large .stars {
    color: #ffd700;
}

.recipe-content-main .recipe-description {
    font-size: 16px;
    line-height: 1.8;
    color: #555;
}

/* Eski recipe-header kaldırıldı - artık kullanılmıyor */

.recipe-documents {
    margin-bottom: 40px;
}

.recipe-documents h3 {
    font-size: 24px;
    margin-bottom: 20px;
}

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

.document-page {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.document-page img {
    width: 100%;
    height: auto;
    display: block;
}

.page-number {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
}

/* Değerlendirme Özeti */
.recipe-ratings-summary {
    margin-bottom: 40px;
}

.recipe-ratings-summary h3 {
    font-size: 24px;
    margin-bottom: 20px;
}

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

.stars-count {
    width: 50px;
    font-weight: 600;
}

.bar-container {
    flex: 1;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #ff6b9d 0%, #c06c84 100%);
    transition: width 0.3s;
}

/* Paylaşım */
.recipe-share {
    text-align: center;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 12px;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.share-btn {
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    transition: transform 0.2s;
}

.share-btn:hover {
    transform: scale(1.05);
}

.share-btn.facebook { background: #3b5998; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.whatsapp { background: #25d366; }

/* === Slider === */
.amigurumi-slider {
    position: relative;
    margin-bottom: 30px;
}

.slider-container {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
}

.slider-wrapper {
    position: relative;
    width: 100%;
    padding-top: 40%;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s;
}

.slide.active {
    opacity: 1;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slider-prev,
.slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    font-size: 30px;
    padding: 10px 15px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s;
}

.slider-prev:hover,
.slider-next:hover {
    background: rgba(255, 255, 255, 1);
}

.slider-prev { left: 10px; }
.slider-next { right: 10px; }

.slider-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s;
}

.dot.active {
    background: white;
    width: 30px;
    border-radius: 6px;
}

/* === Responsive === */
@media (max-width: 1200px) {
    .amigurumi-recipes-grid,
    .results-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 968px) {
    .amigurumi-recipes-grid,
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .recipe-content-main .recipe-title {
        font-size: 26px;
    }
}

@media (max-width: 768px) {
    .amigurumi-recipes-grid,
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .recipe-content-main .recipe-title {
        font-size: 24px;
    }

    .documents-grid {
        grid-template-columns: 1fr;
    }

    .share-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .amigurumi-recipes-grid,
    .results-grid {
        grid-template-columns: 1fr;
    }

    .amigurumi-filters {
        flex-direction: column;
    }
}

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

.amigurumi-recipe-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.amigurumi-recipe-card:nth-child(1) { animation-delay: 0.1s; }
.amigurumi-recipe-card:nth-child(2) { animation-delay: 0.2s; }
.amigurumi-recipe-card:nth-child(3) { animation-delay: 0.3s; }
.amigurumi-recipe-card:nth-child(4) { animation-delay: 0.4s; }
.amigurumi-recipe-card:nth-child(5) { animation-delay: 0.5s; }
.amigurumi-recipe-card:nth-child(6) { animation-delay: 0.6s; }

.amigurumi-recipe-card.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

/* Lazy Loading Görseller */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s;
}

img.loaded {
    opacity: 1;
}

/* === "Yukarı Çık" Butonu === */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ff6b9d 0%, #c06c84 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.back-to-top:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.back-to-top span {
    display: block;
    line-height: 1;
}

/* === Favori Butonu === */
.favorite-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s;
    z-index: 5;
}

.favorite-btn:hover {
    background: white;
    transform: scale(1.1);
}

.favorite-btn::before {
    content: "♡";
    color: #ff6b9d;
}

.favorite-btn.is-favorite::before {
    content: "♥";
    color: #ff6b9d;
}

/* === Skeleton Loading === */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    border-radius: 16px;
    overflow: hidden;
}

.skeleton-image {
    width: 100%;
    height: 250px;
}

.skeleton-text {
    height: 20px;
    margin: 10px;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 60%;
}

/* === Hover Efektleri === */
.amigurumi-recipe-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.amigurumi-recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.recipe-image img {
    transition: transform 0.5s ease;
}

.amigurumi-recipe-card:hover .recipe-image img {
    transform: scale(1.05);
}

/* === Dark Mode Desteği === */
@media (prefers-color-scheme: dark) {
    .amigurumi-recipe-card {
        background: #2d2d2d;
        color: #f0f0f0;
    }

    .recipe-title {
        color: #f0f0f0;
    }

    .recipe-excerpt {
        color: #c0c0c0;
    }

    #amigurumi-search-input {
        background: #2d2d2d;
        color: #f0f0f0;
        border-color: #444;
    }

    .suggestion-tag {
        background: #2d2d2d;
        border-color: #444;
        color: #f0f0f0;
    }
}
