﻿/* ==========================================
   Advanced Search Page Styles
   PiyumLanka - Attractive Option 2 Design
   ========================================== */

/* Color Variables - Attractive First */
:root {
    /* Soft Pastels */
    --soft-lavender: #E6D5E8;
    --powder-pink: #F7D5E0;
    --mint-cream: #E8F5E9;
    --peach-blossom: #FFDAB9;
    --baby-blue: #E3F2FD;
    /* Cultural Colors */
    --saffron-gold: #FFB347;
    --lotus-pink: #F4C2C2;
    --peacock-teal: #A5D6D6;
    --kandyan-red: #D4918C;
    /* Emotional Response Colors */
    --joy-apricot: #FFE5B4;
    --trust-periwinkle: #B8D4E8;
    --hope-sage: #C8E6C9;
    --love-pink: #F8BBD0;
    /* Gradients */
    --gradient-hero: linear-gradient(135deg, #E6D5E8 0%, #F7D5E0 50%, #FFE5B4 100%);
    --gradient-card-girl: linear-gradient(135deg, #FFB3D9 0%, #FFC4E8 100%);
    --gradient-card-boy: linear-gradient(135deg, #A8DAFF 0%, #B8C5FF 100%);
    --gradient-button: linear-gradient(135deg, #F4C2C2 0%, #FFB347 100%);
    --gradient-button-hover: linear-gradient(135deg, #FFB347 0%, #F4C2C2 100%);
    /* Text Colors */
    --text-primary: #2D3748;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --text-light: #A0AEC0;
    /* Background */
    --bg-light: #FAFBFC;
    --bg-white: #FFFFFF;
    /* Borders */
    --border-light: #E2E8F0;
    --border-medium: #CBD5E0;
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.2);
}

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', 'Noto Sans Sinhala', sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================
   Hero Section
   ========================================== */
.search-hero {
    background: var(--gradient-hero);
    padding: 4rem 1.5rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom-left-radius: 2rem;
    border-bottom-right-radius: 2rem;
    box-shadow: var(--shadow-md);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Floating Decorations */
.hero-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.float-icon {
    position: absolute;
    font-size: 2rem;
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
}

    .float-icon:nth-child(1) {
        top: 10%;
        left: 10%;
        animation-delay: 0s;
    }

    .float-icon:nth-child(2) {
        top: 20%;
        right: 15%;
        animation-delay: 2s;
    }

    .float-icon:nth-child(3) {
        bottom: 20%;
        left: 20%;
        animation-delay: 1s;
    }

    .float-icon:nth-child(4) {
        bottom: 15%;
        right: 10%;
        animation-delay: 3s;
    }

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-20px) rotate(5deg);
    }

    75% {
        transform: translateY(20px) rotate(-5deg);
    }
}

/* ==========================================
   Filters Section
   ========================================== */
.filters-section {
    padding: 2rem 20px;
    background: var(--bg-white);
}

.filters-form {
    max-width: 1000px;
    margin: 0 auto;
}

/* Main Search Bar */
.search-bar-wrapper {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-input-container {
    flex: 1;
    min-width: 250px;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: 50px;
    padding: 0 1rem;
    transition: all 0.3s ease;
}

    .search-input-container:focus-within {
        border-color: var(--saffron-gold);
        box-shadow: 0 4px 12px rgba(255, 179, 71, 0.2);
    }

.search-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 1rem 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    background: transparent;
}

    .search-input::placeholder {
        color: var(--text-light);
    }

.clear-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s;
}

    .clear-btn:hover {
        color: var(--text-primary);
    }

.search-btn {
    padding: 1rem 2.5rem;
    background: var(--gradient-button);
    color: var(--bg-white);
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    white-space: nowrap;
}

    .search-btn:hover {
        background: var(--gradient-button-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

/* Filters Panel */
.filters-panel {
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF9F5 100%);
    border-radius: 20px;
    padding: 1.5rem;
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 0.5rem 0;
}

    .filters-header:hover .filters-title {
        color: var(--saffron-gold);
    }

.filters-icon {
    font-size: 1.5rem;
}

.filters-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    margin-left: 0.75rem;
    transition: color 0.2s;
}

.toggle-btn {
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .toggle-btn:hover {
        border-color: var(--saffron-gold);
        background: #FFF9F5;
    }

.toggle-icon {
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

/* Filters Content */
.filters-content {
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-light);
    margin-top: 1rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Filter Group */
.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-label {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.label-icon {
    font-size: 1.125rem;
    margin-right: 0.5rem;
}

/* Filter Buttons (Radio) */
.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-option {
    position: relative;
    cursor: pointer;
    user-select: none;
}

    .filter-option input[type="radio"] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .filter-option span {
        display: inline-block;
        padding: 0.625rem 1rem;
        background: var(--bg-white);
        border: 2px solid var(--border-light);
        border-radius: 50px;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-secondary);
        transition: all 0.3s ease;
    }

    .filter-option:hover span {
        border-color: var(--saffron-gold);
        color: var(--saffron-gold);
    }

    .filter-option.active span,
    .filter-option input[type="radio"]:checked + span {
        background: var(--gradient-button);
        border-color: transparent;
        color: var(--bg-white);
        box-shadow: 0 2px 8px rgba(255, 179, 71, 0.3);
    }

/* Filter Select (Dropdown) */
.filter-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 0.938rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%234A5568' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

    .filter-select:hover,
    .filter-select:focus {
        border-color: var(--saffron-gold);
        outline: none;
    }

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.reset-btn,
.apply-btn {
    padding: 0.75rem 2rem;
    border-radius: 12px;
    font-size: 0.938rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn {
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    color: var(--text-secondary);
}

    .reset-btn:hover {
        border-color: var(--saffron-gold);
        color: var(--saffron-gold);
    }

.apply-btn {
    background: var(--gradient-button);
    border: none;
    color: var(--bg-white);
    box-shadow: var(--shadow-sm);
}

    .apply-btn:hover {
        background: var(--gradient-button-hover);
        box-shadow: var(--shadow-md);
    }

/* ==========================================
   Results Section
   ========================================== */
.results-section {
    padding: 2rem 20px 4rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

    .results-count span {
        color: var(--saffron-gold);
    }

.sort-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sort-label {
    font-size: 0.938rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.sort-select {
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%234A5568' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

    .sort-select:hover,
    .sort-select:focus {
        border-color: var(--saffron-gold);
        outline: none;
    }

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Name Card */
.name-card {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 1.5rem;
    border: 2px solid var(--border-light);
    position: relative;
    overflow: visible; /* ✅ CHANGED: Was hidden, now visible */
    transition: all 0.3s ease;
}

    .name-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-color: var(--saffron-gold);
    }

.name-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Gender Badge */
.name-gender-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.813rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.gender-boy,
.gender-male {
    background: var(--gradient-card-boy);
    color: #1e40af;
}

.gender-girl,
.gender-female {
    background: var(--gradient-card-girl);
    color: #be123c;
}

.gender-unisex {
    background: linear-gradient(135deg, #FFE5B4 0%, #FFF9C4 100%);
    color: #8b5a00;
}

/* Name Content */
.name-content {
    display: flex;
    flex-direction: column;
}

.name-sinhala {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-family: 'Noto Sans Sinhala', sans-serif;
}

.name-english {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Name Meaning */
.name-meaning {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 1rem;
    background: linear-gradient(135deg, #FFF9F5 0%, #FFFFFF 100%);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.meaning-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.name-meaning p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Meta Tags */
.name-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.tag-icon {
    font-size: 0.875rem;
}

/* Stats */
.name-stats {
    display: flex;
    gap: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.stat-icon {
    font-size: 1rem;
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ==========================================
   CARD ACTIONS - CORRECTED VERSION
   ========================================== */
.card-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 10;
    /* ✅ REMOVED: opacity: 0 - buttons now always visible */
}

/* ✅ REMOVED: hover state that showed buttons */
/* Buttons are now always visible, not just on hover */

.action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

    .action-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

/* ==========================================
   FAVORITE BUTTON STYLES
   ========================================== */
.favorite-btn i {
    font-size: 20px;
    color: #CBD5E0;
    transition: all 0.3s ease;
}

.favorite-btn:hover {
    border-color: #F56565;
}

    .favorite-btn:hover i {
        color: #F56565;
        transform: scale(1.2);
    }

.favorite-btn.active {
    border-color: #F56565;
    background: rgba(245, 101, 101, 0.05);
}

    .favorite-btn.active i {
        color: #F56565;
        animation: heartbeat 0.6s ease;
    }

/* Heartbeat animation */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.3);
    }

    50% {
        transform: scale(1.1);
    }

    75% {
        transform: scale(1.25);
    }
}

/* Loading state */
.favorite-btn:disabled,
.share-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

    .favorite-btn:disabled i,
    .share-btn:disabled i {
        animation: spin 1s linear infinite;
    }

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   SHARE BUTTON STYLES
   ========================================== */
.share-btn i {
    font-size: 18px;
    color: #4299E1;
    transition: all 0.3s ease;
}

.share-btn:hover {
    background: #4299E1;
    border-color: #4299E1;
}

    .share-btn:hover i {
        color: white;
    }

/* ==========================================
   TOAST NOTIFICATION
   ========================================== */
.toast-notification {
    font-family: 'Poppins', sans-serif;
}

.toast-icon {
    font-size: 20px;
    font-weight: bold;
}

.toast-message {
    font-size: 14px;
}

/* ==========================================
   No Results
   ========================================== */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-white);
    border-radius: 20px;
    border: 2px dashed var(--border-medium);
    margin-top: 2rem;
}

.no-results-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.no-results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.no-results-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.reset-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--gradient-button);
    color: var(--bg-white);
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

    .reset-all-btn:hover {
        background: var(--gradient-button-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

/* ==========================================
   Pagination
   ========================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.page-btn,
.page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 1rem;
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.938rem;
    transition: all 0.3s ease;
}

.page-btn {
    gap: 0.5rem;
}

    .page-btn:hover,
    .page-number:hover {
        border-color: var(--saffron-gold);
        color: var(--saffron-gold);
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
    }

.page-number.active {
    background: var(--gradient-button);
    border-color: transparent;
    color: var(--bg-white);
    box-shadow: 0 4px 12px rgba(255, 179, 71, 0.3);
}

.page-numbers {
    display: flex;
    gap: 0.5rem;
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .search-bar-wrapper {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        flex-direction: column;
    }

    .reset-btn,
    .apply-btn {
        width: 100%;
        justify-content: center;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .sort-control {
        width: 100%;
        justify-content: space-between;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card-actions {
        top: 12px;
        right: 12px;
    }

    .action-btn {
        width: 36px;
        height: 36px;
    }

    .favorite-btn i {
        font-size: 18px;
    }

    .share-btn i {
        font-size: 16px;
    }

    .pagination {
        gap: 0.5rem;
    }

    .page-btn,
    .page-number {
        min-width: 40px;
        height: 40px;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .hero-icon {
        font-size: 3rem;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .name-sinhala {
        font-size: 1.5rem;
    }

    .filter-option span {
        padding: 0.5rem 0.75rem;
        font-size: 0.813rem;
    }
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
    .search-hero,
    .filters-section,
    .card-actions,
    .pagination {
        display: none;
    }

    .name-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
