/**
 * Community Tips Page Styles
 * Version: 4.6.0
 * Last Updated: 2025-12-10
 * Added: Product images in tip cards (v4.6.0)
 */

/* Hero Section */
.community-hero {
    background: var(--gradient-primary);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.community-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.community-hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 24px;
}

.btn-share-tip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: white;
    color: var(--theme-primary);
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-share-tip:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Container */
.community-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Submit Form Card */
.submit-form-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow: hidden;
}

.submit-form-card .card-header {
    padding: 16px 20px;
    background: var(--gradient-info);
    border-bottom: 1px solid color-mix(in srgb, var(--theme-primary) 20%, white);
}

.submit-form-card .card-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--theme-primary);
}

.submit-form-card .card-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary) 10%, transparent);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-submit {
    flex: 1;
    padding: 12px 24px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-cancel {
    padding: 12px 24px;
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cancel:hover {
    background: #e5e7eb;
}

/* Success Message */
.success-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.success-message h3 {
    margin: 16px 0 8px;
    color: #10b981;
}

.success-message p {
    color: #6b7280;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filter-icon {
    color: #9ca3af;
}

.filter-bar select {
    flex: 1;
    max-width: 250px;
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    background: white;
    cursor: pointer;
}

.filter-bar select:focus {
    outline: none;
    border-color: var(--theme-primary);
}

/* Tips Grid - Masonry Layout */
.tips-grid {
    column-count: 1;
    column-gap: 24px;
}

/* Tip Card */
.tip-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    break-inside: avoid;
    margin-bottom: 24px;
}

.tip-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.tip-header {
    padding: 20px;
    border-bottom: 1px solid #f3f4f6;
}

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.category-shopping_hacks {
    background: #dbeafe;
    color: #1e40af;
}

.category-product_reviews {
    background: #ede9fe;
    color: #5b21b6;
}

.category-seller_tips {
    background: #d1fae5;
    color: #065f46;
}

.category-general_advice {
    background: color-mix(in srgb, var(--theme-primary) 15%, white);
    color: var(--theme-primary);
}

.category-deals_alerts {
    background: #fef3c7;
    color: #92400e;
}

.tip-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 12px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tip-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #6b7280;
}

.tip-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tip-meta svg {
    opacity: 0.7;
}

.tip-content {
    padding: 20px;
    color: #374151;
    line-height: 1.7;
    font-size: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tip-footer {
    padding: 16px 20px;
    border-top: 1px solid #f3f4f6;
    background: #f9fafb;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.like-btn:hover:not(:disabled) {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}

.like-btn:hover:not(:disabled) svg {
    fill: var(--theme-primary);
}

.like-btn.liked {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.like-btn.liked svg {
    fill: white;
}

.like-btn:disabled {
    cursor: default;
}

.like-count {
    font-weight: 700;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.empty-state svg {
    margin-bottom: 20px;
}

.empty-state p {
    color: #6b7280;
    font-size: 1.1rem;
    margin-bottom: 24px;
}

/* RTL Support */
[dir="rtl"] .tip-meta {
    flex-direction: row-reverse;
}

[dir="rtl"] .tip-meta span {
    flex-direction: row-reverse;
}

[dir="rtl"] .like-btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .btn-share-tip {
    flex-direction: row-reverse;
}

/* Responsive - Tablet (576px+): 2 columns */
@media (min-width: 576px) {
    .tips-grid {
        column-count: 2;
    }
}

/* Responsive - Desktop (992px+): 3 columns */
@media (min-width: 992px) {
    .tips-grid {
        column-count: 3;
    }
}

/* Responsive - Mobile adjustments */
@media (max-width: 768px) {
    .community-hero {
        padding: 40px 20px;
    }

    .community-hero h1 {
        font-size: 1.75rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .filter-bar {
        flex-wrap: wrap;
    }

    .filter-bar select {
        max-width: 100%;
    }
}

/* Responsive - Small mobile adjustments */
@media (max-width: 576px) {
    .submit-form-card .card-body {
        padding: 16px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .tip-header {
        padding: 16px;
    }

    .tip-content {
        padding: 16px;
        font-size: 14px;
    }

    .tip-footer {
        padding: 12px 16px;
    }

    .tip-title {
        font-size: 1rem;
    }

    .tip-meta {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 12px;
    }

    .category-badge {
        font-size: 11px;
        padding: 3px 10px;
    }

    .like-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .product-link-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* ========================================
   PRODUCT URL FIELD - v4.2.0
   ======================================== */

.form-group label .required {
    color: #ef4444;
    margin-left: 2px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #6b7280;
}

/* Product Link Button on Tip Cards */
.product-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-right: 12px;
}

.product-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.35);
    color: white;
    text-decoration: none;
}

.product-link-btn svg {
    flex-shrink: 0;
}

.tip-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

[dir="rtl"] .product-link-btn {
    flex-direction: row-reverse;
    margin-right: 0;
    margin-left: 12px;
}

/* ========================================
   SUCCESS MODAL - v4.1.0
   ======================================== */

.success-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.success-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.success-modal-content {
    position: relative;
    background: white;
    border-radius: 1.5rem;
    padding: 2.5rem 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.success-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.success-modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.success-modal-icon {
    margin-bottom: 1.25rem;
}

.success-modal-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.75rem;
}

.success-modal-content p {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.btn-success-ok {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-success-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Mobile adjustments for modal */
@media (max-width: 480px) {
    .success-modal-content {
        padding: 2rem 1.5rem;
        border-radius: 1rem;
        margin: 0.5rem;
    }

    .success-modal-content h3 {
        font-size: 1.25rem;
    }

    .success-modal-content p {
        font-size: 0.9375rem;
    }

    .success-modal-icon svg {
        width: 48px;
        height: 48px;
    }

    .btn-success-ok {
        width: 100%;
        padding: 1rem;
    }
}

/* ========================================
   PRODUCT PREVIEW - v4.4.0
   ======================================== */

.product-preview {
    margin-top: 12px;
    border-radius: 10px;
    overflow: hidden;
}

.product-preview-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 14px;
}

.product-preview-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--theme-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.product-preview-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f0fdf4;
    border: 1px solid #86efac;
}

.product-preview-content img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    background: white;
}

.product-preview-info {
    flex: 1;
    min-width: 0;
}

.product-preview-info span {
    display: block;
}

#previewTitle {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-platform {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    text-transform: capitalize;
}

.preview-remove {
    width: 28px;
    height: 28px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.preview-remove:hover {
    background: #fecaca;
}

.product-preview-error {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-size: 14px;
}

/* Tip Card Product Image */
.tip-product-image {
    margin: 12px 0;
    text-align: center;
}

.tip-product-image img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    background-color: #f9fafb;
}

@media (max-width: 576px) {
    .tip-product-image img {
        max-height: 150px;
    }
}
