/**
 * Tasawwq AI Visual Search (Lens AI) Styles
 * Brand-aligned with Tasawwq.com
 */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap');

:root {
    --tasawwq-red: #c92127;
    --tasawwq-red-hover: #ab1a20;
    --tasawwq-red-light: #fff1f2;
    --tasawwq-red-border: #fecdd3;
    --tasawwq-dark: #1e293b;
    --tasawwq-muted: #64748b;
    --tasawwq-border: #e2e8f0;
    --tasawwq-bg: #ffffff;
    --tasawwq-card-bg: #ffffff;
    --tasawwq-green: #16a34a;
    --tasawwq-green-light: #dcfce7;
    --tasawwq-radius: 20px;
    --tasawwq-font: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tasawwq-lens-container {
    max-width: 920px;
    margin: 35px auto;
    font-family: var(--tasawwq-font);
    color: var(--tasawwq-dark);
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
}

.tasawwq-lens-container * {
    box-sizing: border-box;
    font-family: inherit;
}

/* Main Card */
.tasawwq-lens-card {
    background: var(--tasawwq-card-bg);
    border: 1px solid var(--tasawwq-border);
    border-radius: var(--tasawwq-radius);
    padding: 36px;
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.07);
    position: relative;
    overflow: hidden;
}

/* Header */
.tasawwq-lens-header {
    text-align: center;
    margin-bottom: 28px;
}

.tasawwq-lens-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--tasawwq-red-light);
    color: var(--tasawwq-red);
    border: 1px solid var(--tasawwq-red-border);
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 14px;
}

.lens-sparkle {
    animation: sparkleSpin 3s linear infinite;
}

@keyframes sparkleSpin {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.tasawwq-lens-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--tasawwq-dark);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.tasawwq-lens-header p {
    font-size: 15px;
    color: var(--tasawwq-muted);
    margin: 0;
    line-height: 1.6;
}

/* Dropzone */
.tasawwq-lens-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 18px;
    background: #f8fafc;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.25s ease;
    position: relative;
    cursor: pointer;
}

.tasawwq-lens-dropzone:hover,
.tasawwq-lens-dropzone.is-dragover {
    border-color: var(--tasawwq-red);
    background: var(--tasawwq-red-light);
}

.tasawwq-drop-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 16px auto;
    background: #ffffff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--tasawwq-red);
    box-shadow: 0 10px 25px -5px rgba(201, 33, 39, 0.15);
    transition: transform 0.2s ease;
}

.tasawwq-lens-dropzone:hover .tasawwq-drop-icon {
    transform: scale(1.08);
}

.tasawwq-drop-idle h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--tasawwq-dark);
    margin: 0 0 6px 0;
}

.tasawwq-drop-idle p {
    font-size: 14px;
    color: var(--tasawwq-muted);
    margin: 0 0 20px 0;
}

.tasawwq-drop-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.tasawwq-btn-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tasawwq-btn-upload {
    background: var(--tasawwq-dark);
    color: #ffffff;
}

.tasawwq-btn-upload:hover {
    background: #0f172a;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.15);
}

.tasawwq-btn-camera {
    background: #ffffff;
    color: var(--tasawwq-red);
    border: 1px solid var(--tasawwq-red-border);
}

.tasawwq-btn-camera:hover {
    background: var(--tasawwq-red);
    color: #ffffff;
    border-color: var(--tasawwq-red);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(201, 33, 39, 0.18);
}

.tasawwq-drop-hint {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
}

/* Image Preview Container */
.tasawwq-preview-box {
    position: relative;
    max-width: 320px;
    margin: 0 auto;
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--tasawwq-border);
}

.tasawwq-img-tag {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    background: #f8fafc;
}

/* Laser Scanning Beam Animation */
.tasawwq-scanner-beam {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ff0015, #ffffff, #ff0015, transparent);
    box-shadow: 0 0 15px 4px rgba(201, 33, 39, 0.8);
    animation: laserScan 1.8s ease-in-out infinite alternate;
    z-index: 5;
}

@keyframes laserScan {
    0% { top: 2%; opacity: 0.8; }
    50% { opacity: 1; }
    100% { top: 96%; opacity: 0.8; }
}

.tasawwq-btn-change-img {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    color: #ffffff;
    border: 0;
    border-radius: 9999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.tasawwq-btn-change-img:hover {
    background: var(--tasawwq-red);
}

/* Submit Bar */
.tasawwq-submit-bar {
    margin-top: 20px;
    text-align: center;
}

.tasawwq-btn-search {
    background: linear-gradient(135deg, #c92127 0%, #e11d48 100%);
    color: #ffffff;
    border: 0;
    border-radius: 14px;
    padding: 16px 36px;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 25px -3px rgba(201, 33, 39, 0.35);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 260px;
}

.tasawwq-btn-search:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -3px rgba(201, 33, 39, 0.45);
    background: linear-gradient(135deg, #b91c1c 0%, #be123c 100%);
}

.tasawwq-btn-search:disabled {
    opacity: 0.75;
    cursor: wait;
}

.tasawwq-btn-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tasawwq-btn-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* Dynamic Status Bar */
.tasawwq-lens-status {
    margin-top: 24px;
    background: #f8fafc;
    border: 1px solid var(--tasawwq-border);
    border-radius: 14px;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.tasawwq-status-loader {
    display: flex;
    gap: 6px;
}

.tasawwq-pulse-dot {
    width: 10px;
    height: 10px;
    background: var(--tasawwq-red);
    border-radius: 50%;
    animation: pulseDot 1.4s infinite ease-in-out both;
}

.tasawwq-pulse-dot:nth-child(1) { animation-delay: -0.32s; }
.tasawwq-pulse-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes pulseDot {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

.tasawwq-status-msg {
    font-size: 15px;
    font-weight: 700;
    color: var(--tasawwq-dark);
}

/* RESULTS SECTION */
.tasawwq-lens-results {
    margin-top: 32px;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* FOUND STATE */
.tasawwq-result-found {
    background: #ffffff;
    border: 1px solid #bbf7d0;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 10px 30px -5px rgba(22, 163, 74, 0.08);
}

.tasawwq-match-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--tasawwq-green-light);
    color: #166534;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 22px;
}

.tasawwq-match-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tasawwq-pulse-green {
    width: 8px;
    height: 8px;
    background: #16a34a;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

.tasawwq-product-main {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
    align-items: center;
}

.tasawwq-product-media {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid var(--tasawwq-border);
}

.tasawwq-product-img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

.tasawwq-product-media:hover .tasawwq-product-img {
    transform: scale(1.05);
}

.tasawwq-sale-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--tasawwq-red);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
}

.tasawwq-product-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tasawwq-product-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tasawwq-tag {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}

.tasawwq-tag.cat {
    background: #f1f5f9;
    color: #475569;
}

.tasawwq-tag.sku {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid var(--tasawwq-border);
}

.tasawwq-tag.stock-yes {
    background: var(--tasawwq-green-light);
    color: #166534;
}

.tasawwq-tag.stock-no {
    background: #fee2e2;
    color: #991b1b;
}

.tasawwq-product-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    line-height: 1.4;
}

.tasawwq-product-title a {
    color: var(--tasawwq-dark);
    text-decoration: none;
    transition: color 0.2s;
}

.tasawwq-product-title a:hover {
    color: var(--tasawwq-red);
}

.tasawwq-product-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--tasawwq-red);
    margin: 4px 0;
}

.tasawwq-product-price del {
    font-size: 16px;
    color: #94a3b8;
    margin-left: 8px;
    font-weight: 500;
}

.tasawwq-product-price ins {
    text-decoration: none;
}

.tasawwq-ai-reason {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #166534;
    line-height: 1.5;
}

.tasawwq-product-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.tasawwq-btn-buy {
    background: var(--tasawwq-red);
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    border: 0;
    cursor: pointer;
}

.tasawwq-btn-buy:hover {
    background: var(--tasawwq-red-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(201, 33, 39, 0.25);
}

.tasawwq-btn-view {
    background: #ffffff;
    color: var(--tasawwq-dark) !important;
    text-decoration: none !important;
    border: 1px solid var(--tasawwq-border);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.tasawwq-btn-view:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* SIMILAR PRODUCTS SECTION */
.tasawwq-similar-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--tasawwq-border);
}

.tasawwq-similar-heading {
    font-size: 18px;
    font-weight: 800;
    color: var(--tasawwq-dark);
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tasawwq-similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.tasawwq-similar-card {
    background: #ffffff;
    border: 1px solid var(--tasawwq-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.tasawwq-similar-card:hover {
    border-color: var(--tasawwq-red-border);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.tasawwq-similar-img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
    margin-bottom: 8px;
}

.tasawwq-similar-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 6px 0;
    line-height: 1.4;
    height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tasawwq-similar-title a {
    color: var(--tasawwq-dark);
    text-decoration: none;
}

.tasawwq-similar-price {
    font-size: 15px;
    font-weight: 800;
    color: var(--tasawwq-red);
    margin-top: auto;
    margin-bottom: 8px;
}

.tasawwq-similar-btn {
    background: #f1f5f9;
    color: var(--tasawwq-dark);
    text-decoration: none;
    text-align: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s;
}

.tasawwq-similar-btn:hover {
    background: var(--tasawwq-red);
    color: #ffffff;
}

/* NOT FOUND / SUGGESTIONS STATE */
.tasawwq-result-notfound {
    background: #fff7f7;
    border: 1px solid #fecaca;
    border-radius: 18px;
    padding: 32px 24px;
    text-align: center;
}

.tasawwq-notfound-icon {
    width: 64px;
    height: 64px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 16px auto;
}

.tasawwq-result-notfound h3 {
    font-size: 22px;
    font-weight: 800;
    color: #991b1b;
    margin: 0 0 8px 0;
}

.tasawwq-result-notfound p {
    font-size: 15px;
    color: #64748b;
    margin: 0 0 16px 0;
}

.tasawwq-recognized-pill {
    display: inline-block;
    background: #ffffff;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 24px;
}

.tasawwq-cat-suggestions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #fca5a5;
}

.tasawwq-cat-suggestions h4 {
    font-size: 15px;
    font-weight: 700;
    color: #475569;
    margin: 0 0 12px 0;
}

.tasawwq-cat-pills {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tasawwq-cat-pill {
    background: #ffffff;
    color: var(--tasawwq-dark);
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tasawwq-cat-pill:hover {
    border-color: var(--tasawwq-red);
    color: var(--tasawwq-red);
    background: var(--tasawwq-red-light);
}

.tasawwq-reset-btn-wrap {
    margin-top: 24px;
    text-align: center;
}

.tasawwq-btn-reset {
    background: #ffffff;
    color: var(--tasawwq-dark);
    border: 1px solid var(--tasawwq-border);
    padding: 10px 20px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.tasawwq-btn-reset:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

/* Toast Message */
.tasawwq-toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #1e293b;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    animation: toastSlide 0.3s ease;
    direction: rtl;
}

@keyframes toastSlide {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 650px) {
    .tasawwq-lens-card {
        padding: 20px 16px;
        border-radius: 16px;
    }
    .tasawwq-lens-header h2 {
        font-size: 22px;
    }
    .tasawwq-lens-dropzone {
        padding: 24px 14px;
    }
    .tasawwq-product-main {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .tasawwq-product-tags,
    .tasawwq-product-actions {
        justify-content: center;
    }
    .tasawwq-btn-search {
        width: 100%;
    }
}
