/**
 * Seneweb GIF Picker Styles
 * Powered by Tenor API
 */

/* Modal Overlay */
.gif-picker-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.gif-picker-modal.open {
    display: block;
}

.gif-picker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

/* Modal Container */
.gif-picker-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.gif-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.gif-picker-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.gif-picker-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.gif-picker-close:hover {
    background: #e9ecef;
    color: #333;
}

/* Search */
.gif-picker-search {
    position: relative;
    padding: 12px 16px;
    background: #fff;
}

.gif-picker-search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    font-size: 15px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.gif-picker-search-input:focus {
    border-color: #667eea;
}

.gif-picker-search-input::placeholder {
    color: #adb5bd;
}

.gif-picker-search-icon {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    pointer-events: none;
}

/* Categories */
.gif-picker-categories {
    display: flex;
    gap: 6px;
    padding: 8px 16px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.gif-picker-categories::-webkit-scrollbar {
    display: none;
}

.gif-picker-category {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #f1f3f5;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    color: #495057;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.gif-picker-category:hover {
    background: #e9ecef;
}

.gif-picker-category.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.gif-cat-icon {
    font-size: 14px;
}

.gif-cat-name {
    font-weight: 500;
}

/* Content Area */
.gif-picker-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    min-height: 300px;
    max-height: 400px;
    background: #f8f9fa;
}

/* GIF Grid */
.gif-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.gif-picker-item {
    position: relative;
    aspect-ratio: 1;
    background: #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gif-picker-item:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gif-picker-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Loading Indicator */
.gif-picker-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 12px;
    color: #6c757d;
}

.gif-picker-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e9ecef;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: gif-spinner 0.8s linear infinite;
}

@keyframes gif-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Load More Button */
.gif-picker-load-more {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gif-picker-load-more:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

/* Error State */
.gif-picker-error {
    text-align: center;
    padding: 40px;
    color: #dc3545;
    font-size: 14px;
}

/* Preview */
.gif-picker-preview {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10;
}

.gif-picker-preview-img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.gif-picker-preview-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.gif-picker-preview-cancel,
.gif-picker-preview-confirm {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gif-picker-preview-cancel {
    background: #f1f3f5;
    border: none;
    color: #495057;
}

.gif-picker-preview-cancel:hover {
    background: #e9ecef;
}

.gif-picker-preview-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
}

.gif-picker-preview-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Footer */
.gif-picker-footer {
    padding: 10px 16px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.gif-picker-footer a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.gif-picker-footer a:hover {
    opacity: 1;
}

/* GIF Button for Comment Form */
.gif-picker-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 18px;
}

.gif-picker-trigger:hover {
    background: #f1f3f5;
}

.gif-picker-trigger img {
    width: 24px;
    height: 24px;
}

/* Mobile Responsive */
@media (max-width: 576px) {
    .gif-picker-container {
        width: 100%;
        max-width: none;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
    }

    .gif-picker-content {
        max-height: none;
        flex: 1;
    }

    .gif-picker-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .gif-picker-categories {
        padding: 8px 12px;
    }

    .gif-picker-category {
        padding: 6px 10px;
        font-size: 12px;
    }

    .gif-picker-preview-actions {
        width: 100%;
        flex-direction: column;
    }

    .gif-picker-preview-cancel,
    .gif-picker-preview-confirm {
        width: 100%;
    }
}

/* Tablet */
@media (min-width: 577px) and (max-width: 768px) {
    .gif-picker-container {
        max-width: 90%;
    }

    .gif-picker-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop */
@media (min-width: 769px) {
    .gif-picker-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
