/* Pinterest Style Image Search Redesign */
.image-search-container.ios-style {
    max-width: 1400px;
    width: 98%;
    margin: 0 auto;
    padding: 2rem 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ios-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Search Header */
.ios-search-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.ios-search-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #b9a8ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.ios-search-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* Search Input Area */
.ios-input-group {
    position: relative;
    width: 100%;
}

.ios-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1rem 1rem 1rem 3rem;
    color: #fff;
    font-size: 1rem;
    outline: none;
    backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ios-search-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(143, 115, 255, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(143, 115, 255, 0.2);
    transform: translateY(-2px);
}

.ios-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

/* RTL Adjustment */
[dir="rtl"] .ios-search-input {
    padding: 1rem 3rem 1rem 1rem;
}

[dir="rtl"] .ios-search-icon {
    left: auto;
    right: 1rem;
}

/* Filters / Options */
.ios-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.ios-select-wrapper {
    position: relative;
    flex: 1;
}

.ios-select {
    width: 100%;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 15px;
    padding: 0.8rem 1rem;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.ios-select option {
    background: #1f1f1f;
    color: #fff;
}

.ios-search-btn {
    background: linear-gradient(135deg, #8f73ff, #ec4899);
    border: none;
    border-radius: 20px;
    padding: 0.8rem 2rem;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ios-search-btn:hover {
    box-shadow: 0 8px 25px rgba(143, 115, 255, 0.4);
    transform: translateY(-3px) scale(1.02);
}

.ios-search-btn:active {
    transform: scale(0.95);
}

.ios-search-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Pinterest Masonry Grid */
.ios-results-grid {
    column-count: 5;
    column-gap: 15px;
    margin-top: 2rem;
}

@media (max-width: 1200px) {
    .ios-results-grid {
        column-count: 4;
    }
}

@media (max-width: 992px) {
    .ios-results-grid {
        column-count: 3;
    }
}

@media (max-width: 600px) {
    .ios-results-grid {
        column-count: 2;
        column-gap: 10px;
    }
}

.ios-result-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 15px;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: zoom-in;
    background: #1a1a1b;
    border: none;
    padding: 0;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    break-inside: avoid;
    transform-origin: center center;
}

.ios-result-item:hover {
    transform: scale(1.03) translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    z-index: 10;
}

.ios-result-item:hover .ios-result-overlay {
    opacity: 1;
}

.ios-result-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
}

.ios-result-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s;
}

.ios-result-badge {
    align-self: flex-end;
    background: #e60023;
    /* Pinterest Red */
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
}

/* Loading State */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
}

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

/* Status Message */
.ios-status {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    min-height: 20px;
    margin-top: 1rem;
}

.ios-status.error {
    color: #ef4444;
}

.ios-status.success {
    color: #10b981;
}

/* Categories Chips */
.cat-chip {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    white-space: nowrap;
}

.cat-chip:hover {
    background: #fff;
    color: #000;
}

/* Modal (Preview) */
.ios-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ios-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.ios-modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.ios-modal-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.ios-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

.ios-download-btn {
    background: #fff;
    color: #000;
    border: none;
    border-radius: 25px;
    padding: 0.8rem 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

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