/* Sketch to Render Plugin Styles */

/* AI Tools Grid Styles */
.ai-tools-grid-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
    direction: rtl;
    background: #fff;
}

/* Navigation Bar - شبیه عکس نمونه */
.ai-tools-nav {
    display: flex;
    gap: 12px;
    margin: 0;
    padding: 20px 25px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    flex-wrap: wrap;
    overflow-x: auto;
}

.ai-tools-nav-btn {
    background: #f5f5f5;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
    border-radius: 20px;
}

.ai-tools-nav-btn:hover {
    background: #e8e8e8;
    color: #333;
}

.ai-tools-nav-btn.active {
    color: #fff;
    font-weight: 600;
    background: #333;
}

.ai-tools-nav-btn.active::after {
    display: none; /* حذف خط زیرین چون border-bottom داریم */
}

.ai-tools-grid-title {
    display: none;
}

/* Grid Container */
.ai-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 0;
    padding: 25px;
    width: 100%;
    box-sizing: border-box;
}

.ai-tool-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: none;
    display: flex;
    flex-direction: column;
    aspect-ratio: 1;
}

.ai-tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.ai-tool-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ai-tool-image {
    width: 100%;
    height: 100%;
    min-height: 280px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-tool-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ai-tool-card:hover .ai-tool-image img {
    transform: scale(1.05);
}

/* Placeholder colors for different tools */
.ai-tool-placeholder {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* رنگ‌های مختلف برای هر ابزار */
.ai-tool-image[data-tool-key="sketch_to_render"] .ai-tool-placeholder {
    background: #FFD700; /* زرد طلایی */
}

.ai-tool-image[data-tool-key="interior_render"] .ai-tool-placeholder {
    background: #FFB6C1; /* صورتی روشن */
}

.ai-tool-image[data-tool-key="exterior_render"] .ai-tool-placeholder {
    background: #9370DB; /* بنفش */
}

.ai-tool-image[data-tool-key="image_upscale"] .ai-tool-placeholder {
    background: #98FB98; /* سبز روشن */
}

.ai-tool-image[data-tool-key="sketch_to_image"] .ai-tool-placeholder {
    background: #87CEEB; /* آبی آسمانی */
}

.ai-tool-image[data-tool-key="style_transfer"] .ai-tool-placeholder {
    background: #FFA500; /* نارنجی */
}

.ai-tool-image[data-tool-key="masterplan_ai"] .ai-tool-placeholder {
    background: #FF69B4; /* صورتی روشن */
}

.ai-tool-image[data-tool-key="landscape_ai"] .ai-tool-placeholder {
    background: #90EE90; /* سبز */
}

.ai-tool-image[data-tool-key="virtual_staging"] .ai-tool-placeholder {
    background: #20B2AA; /* سبز دریایی */
}

/* نام ابزار روی تصویر - پایین راست */
.ai-tool-name-overlay {
    position: absolute;
    bottom: 16px;
    right: 16px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 2;
    line-height: 1.3;
    text-align: right;
}

/* Credit Badge - آیکون lo X در گوشه تصویر */
.ai-tool-credit-badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 8px;
    padding: 5px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 3;
    font-size: 12px;
    color: #fff;
    font-weight: 500;
}

.ai-tool-credit-badge .credit-icon {
    font-size: 14px;
    opacity: 0.9;
}

.ai-tool-credit-badge .credit-text {
    font-size: 12px;
    letter-spacing: 0.5px;
}

/* Play Icon - در hover */
.ai-tool-play-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.ai-tool-card:hover .ai-tool-play-icon {
    opacity: 1;
}

.ai-tool-play-icon svg {
    width: 16px;
    height: 16px;
    margin-left: 2px;
}

.ai-tool-content {
    display: none; /* حذف بخش content چون نام روی تصویر است */
}

.ai-tool-name {
    display: none;
}

.ai-tool-name-en {
    display: none;
}

.ai-tool-description {
    display: none;
}

.ai-tool-category {
    display: none;
}

/* Filter functionality */
.ai-tool-card[data-category] {
    display: block;
}

.ai-tools-grid.filter-active .ai-tool-card:not([data-category*="render"]):not([data-category*="interior"]):not([data-category*="concept"]):not([data-category*="presentation"]) {
    display: none;
}

/* Responsive Grid */
@media (max-width: 1400px) {
    .ai-tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
    }
}

@media (max-width: 1200px) {
    .ai-tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    }
}

@media (max-width: 992px) {
    .ai-tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    .ai-tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
        padding: 15px;
        gap: 15px;
    }
    
    .ai-tools-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .ai-tools-nav-btn {
        padding: 12px 18px;
        font-size: 14px;
    }
    
    .ai-tool-image {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .ai-tools-grid {
        grid-template-columns: 1fr !important;
    }
    
    .ai-tool-image {
        height: 200px;
    }
}

/* Sketch to Render Plugin Styles */
.sketch-to-render-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    direction: rtl;
}

.sketch-to-render-header {
    text-align: center;
    margin-bottom: 30px;
}

.sketch-to-render-header h2 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.sketch-to-render-header p {
    color: #7f8c8d;
    font-size: 1.2em;
    line-height: 1.6;
}

.sketch-to-render-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.sketch-to-render-main {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.sketch-to-render-instructions {
    margin-bottom: 30px;
}

.sketch-to-render-instructions h3 {
    color: #2c3e50;
    font-size: 1.4em;
    margin-bottom: 15px;
    font-weight: 600;
}

.sketch-to-render-instructions ol {
    color: #5a6c7d;
    line-height: 1.8;
    padding-right: 20px;
}

.sketch-to-render-instructions li {
    margin-bottom: 8px;
    font-size: 0.9em; /* از 1.1em به 0.9em (تقریباً از 12px به 9px) */
}

.sketch-to-render-preview {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

/* Style Transfer: چیدمان سه تصویر */
.sketch-to-render-preview.style-transfer-preview {
    flex-direction: column;
    gap: 30px;
}

.preview-inputs-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

.preview-original,
.preview-reference,
.preview-result {
    flex: 1;
    text-align: center;
}

.preview-plus {
    font-size: 2.5em;
    color: #3498db;
    font-weight: bold;
    margin: 0 10px;
    line-height: 1;
}

.preview-reference h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

.style-transfer-result {
    width: 100%;
    margin-top: 20px;
}

.style-transfer-result .preview-image-container {
    height: 400px;
}

.preview-result-container {
    min-height: 400px;
}

.preview-original h4,
.preview-result h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

.preview-image-container {
    width: 100%;
    height: 300px;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.preview-result {
    position: relative;
}

.preview-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.preview-placeholder {
    color: #95a5a6;
    font-size: 1.1em;
    text-align: center;
}

/* Action Buttons - روی تصویر در پایین */
.preview-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 10px;
    padding: 12px;
    justify-content: center;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 0 0 8px 8px;
    z-index: 5;
}

.action-btn {
    padding: 8px 16px;
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.action-btn span {
    display: none; /* حذف آیکون */
}

/* Lightbox Styles */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.lightbox-overlay.active {
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #333;
    transition: all 0.3s ease;
    z-index: 10000;
}

.lightbox-close:hover {
    background: #fff;
    transform: rotate(90deg);
}

.lightbox-close::before,
.lightbox-close::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 20px;
    background: #333;
}

.lightbox-close::before {
    transform: rotate(45deg);
}

.lightbox-close::after {
    transform: rotate(-45deg);
}

/* Blur effect for body when lightbox is open */
body.lightbox-open {
    overflow: hidden;
}

body.lightbox-open .sketch-to-render-container,
body.lightbox-open .ai-tools-grid-container {
    filter: blur(5px);
    transition: filter 0.3s ease;
    pointer-events: none;
}

.preview-arrow {
    font-size: 2em;
    color: #3498db;
    font-weight: bold;
    animation: pulse 2s infinite;
    transform: scaleX(-1); /* برعکس کردن فلش */
}

/* Loading Spinner */
.preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    z-index: 10;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: #3498db;
    font-size: 16px;
    font-weight: 600;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.sketch-to-render-sidebar {
    width: 350px;
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: sticky;
    top: 20px;
}

.render-settings h3,
.render-settings h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
}

.render-type-options {
    margin-bottom: 25px;
}

.render-type-option {
    display: block;
    padding: 15px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.render-type-option:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.render-type-option.active {
    border-color: #3498db;
    background: #e3f2fd;
}

.render-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-title {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.option-desc {
    display: block;
    color: #7f8c8d;
    font-size: 0.9em;
    line-height: 1.4;
}

.geometry-setting {
    margin-bottom: 25px;
}

.geometry-setting h4 {
    margin-bottom: 10px;
}

.slider-container {
    position: relative;
}

.geometry-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ecf0f1;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.geometry-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.geometry-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.9em;
    color: #7f8c8d;
}

/* Virtual Staging Options */
.virtual-staging-options {
    margin-bottom: 25px;
}

.room-type-setting,
.room-style-setting {
    margin-bottom: 20px;
}

.room-type-setting h4,
.room-style-setting h4 {
    margin-bottom: 10px;
    font-size: 1em;
    color: #2c3e50;
    font-weight: 600;
}

.room-type-select,
.room-style-select {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    background: #fff;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    direction: rtl;
    text-align: right;
    display: flex;
    align-items: center;
    line-height: 1.5;
    min-height: 44px;
    box-sizing: border-box;
}

.room-type-select:focus,
.room-style-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.room-type-select:hover,
.room-style-select:hover {
    border-color: #bdc3c7;
}

.upload-section {
    margin-bottom: 25px;
}

.upload-area {
    position: relative;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.upload-area:hover {
    border-color: #3498db;
    background: #e3f2fd;
}

.upload-area.dragover,
[id^="upload-area"].dragover {
    border-color: #27ae60;
    background: #d5f4e6;
}

.upload-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #7f8c8d;
}

.upload-text {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.upload-hint {
    color: #7f8c8d;
    font-size: 0.9em;
}

.prompt-section {
    margin-bottom: 25px;
}

#prompt-input {
    width: 100%;
    height: 80px;
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#prompt-input:focus {
    outline: none;
    border-color: #3498db;
}

.generate-button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.generate-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #2980b9, #1f4e79);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.generate-button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-loading {
    display: none;
}

.generate-button.loading .button-text {
    display: none;
}

.generate-button.loading .button-loading {
    display: inline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sketch-to-render-content {
        flex-direction: column;
    }
    
    .sketch-to-render-sidebar {
        width: 100%;
        position: static;
    }
    
    .sketch-to-render-preview {
        flex-direction: column;
    }
    
    .preview-arrow {
        transform: rotate(90deg);
    }
    
    .sketch-to-render-header h2 {
        font-size: 2em;
    }
    
    .sketch-to-render-header p {
        font-size: 1em;
    }
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 500;
}

.message.success {
    background: #d5f4e6;
    color: #27ae60;
    border: 1px solid #27ae60;
}

.message.error {
    background: #fadbd8;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

/* File Upload Progress */
.upload-progress {
    width: 100%;
    height: 4px;
    background: #ecf0f1;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    width: 0%;
    transition: width 0.3s ease;
}

/* ==================== Sketch to Image Styles ==================== */

/* Sketch Type Buttons */
.sketch-type-setting {
    margin: 20px 0;
}

.sketch-type-setting h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.sketch-type-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sketch-type-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sketch-type-btn {
    flex: 1;
    min-width: 80px;
    padding: 10px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sketch-type-btn:hover {
    border-color: #4a90e2;
    background: #f0f7ff;
}

.sketch-type-btn.active {
    border-color: #4a90e2;
    background: #4a90e2;
    color: #fff;
}

.sketch-type-icon {
    font-size: 20px;
}

.sketch-type-label {
    font-size: 12px;
    font-weight: 500;
}

/* Camera Angle Settings */
.camera-angle-setting {
    margin: 20px 0;
}

.camera-angle-setting h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.camera-angle-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.camera-angle-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.camera-angle-section h5 {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin: 0;
}

.camera-angle-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.camera-angle-btn {
    flex: 1;
    min-width: 100px;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.camera-angle-btn:hover {
    border-color: #4a90e2;
    background: #f0f7ff;
}

.camera-angle-btn.active {
    border-color: #4a90e2;
    background: #4a90e2;
    color: #fff;
}

.camera-angle-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

.camera-angle-btn.active .camera-angle-dot {
    background: #fff;
}
