/* Prompt Library Styles */

/* Language Selector */
.lang-bar {
    background: #2e2d29;
    padding: 0.5rem 0;
}
.lang-selector {
    display: flex;
    gap: 0.25rem;
    justify-content: flex-end;
}
[dir="rtl"] .lang-selector {
    justify-content: flex-start;
}
.lang-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.7);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}
.lang-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}
.lang-btn.active {
    background: white;
    color: #2e2d29;
    border-color: white;
}

/* RTL Support */
[dir="rtl"] body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* ============ Library Page ============ */

.prompts-hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
    margin-bottom: 2rem;
}

.prompts-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #1a1a2e;
}

.prompts-hero p {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

.section-group {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid;
}

.section-header.designer { border-color: #AD1457; }
.section-header.builder { border-color: #2E7D32; }
.section-header.advocate { border-color: #1565C0; }

.section-header i {
    font-size: 1.75rem;
}

.section-header.designer i { color: #AD1457; }
.section-header.builder i { color: #2E7D32; }
.section-header.advocate i { color: #1565C0; }

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a2e;
}

.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.prompt-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

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

.prompt-card-header {
    padding: 1.25rem 1.5rem;
    color: white;
    position: relative;
}

.prompt-card.designer .prompt-card-header { background: #AD1457; }
.prompt-card.builder .prompt-card-header { background: #2E7D32; }
.prompt-card.advocate .prompt-card-header { background: #1565C0; }

.prompt-card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.prompt-card-header p {
    font-size: 0.875rem;
    margin: 0;
    opacity: 0.9;
}

.prompt-card-body {
    padding: 1.25rem 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.prompt-card-body .description {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.prompt-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.prompt-card.designer .prompt-card-link { color: #AD1457; }
.prompt-card.builder .prompt-card-link { color: #2E7D32; }
.prompt-card.advocate .prompt-card-link { color: #1565C0; }

.prompt-card-link i {
    transition: transform 0.2s ease;
}

.prompt-card:hover .prompt-card-link i {
    transform: translateX(4px);
}

[dir="rtl"] .prompt-card:hover .prompt-card-link i {
    transform: translateX(-4px);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #333;
}

/* QR Code Button */
.qr-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
    line-height: 1;
}

[dir="rtl"] .qr-btn {
    right: auto;
    left: 0.75rem;
}

.qr-btn:hover {
    background: rgba(255,255,255,0.35);
}

.qr-btn i {
    font-size: 1rem;
}

/* QR Modal */
.qr-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.qr-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.qr-modal {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

.qr-modal-backdrop.active .qr-modal {
    transform: scale(1);
}

.qr-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.qr-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a2e;
}

.qr-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.qr-modal-close:hover {
    color: #333;
}

.qr-code-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.qr-code-container canvas,
.qr-code-container img {
    border-radius: 8px;
}

#qrCode {
    display: flex;
    justify-content: center;
    align-items: center;
}

.qr-url-box {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.qr-url-box i {
    color: #999;
    flex-shrink: 0;
}

.qr-url-box span {
    font-size: 0.85rem;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.url-copy-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.url-copy-btn:hover {
    background: #e9ecef;
    color: #333;
}

.url-copy-btn.copied {
    color: #2e7d32;
}

.qr-actions {
    display: flex;
    gap: 0.75rem;
}

.qr-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qr-action-btn.copy,
.qr-action-btn.download {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #333;
}

.qr-action-btn.copy:hover,
.qr-action-btn.download:hover {
    background: #e9ecef;
}

.qr-action-btn.copied {
    background: #2e7d32;
    border-color: #2e7d32;
    color: white;
}

.instructions-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    border-left: 4px solid #6c757d;
}

[dir="rtl"] .instructions-box {
    border-left: none;
    border-right: 4px solid #6c757d;
}

.instructions-box h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #333;
}

.instructions-box p {
    margin: 0;
    color: #555;
    font-size: 0.95rem;
}

.instructions-box code {
    background: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* ============ Prompt Detail Page ============ */

.prompt-detail-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    padding: 0;
}

.prompt-detail-page .lang-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.prompt-detail-wrapper {
    width: 100%;
    max-width: 700px;
    padding: 2rem;
    margin: 2.5rem auto 0;
}

.prompt-detail-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.prompt-detail-card .card-header {
    color: white;
    border-radius: 16px 16px 0 0 !important;
    padding: 1.5rem 2rem;
}

.badge-section {
    background: rgba(255,255,255,0.2);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.prompt-detail-card .card-body {
    padding: 2rem;
}

.prompt-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.prompt-explanation {
    background: #f0f7ff;
    border: 1px solid #d0e3ff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.prompt-explanation h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #555;
}

.prompt-explanation p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
}

.btn-copy {
    border: none;
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s ease;
    color: white;
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    filter: brightness(1.1);
    color: white;
}

.btn-copy.copied {
    background: #2e7d32 !important;
}

.prompt-footer-text {
    color: #999;
    font-size: 0.875rem;
    margin-top: 1.5rem;
}

.prompt-footer-text a {
    color: #666;
}

.prompt-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1rem;
    transition: color 0.2s ease;
}

.prompt-back-link:hover {
    color: #333;
}

[dir="rtl"] .prompt-back-link i.bi-arrow-left {
    transform: scaleX(-1);
}

[dir="rtl"] .back-link i.bi-arrow-left {
    transform: scaleX(-1);
}

/* RTL arrow flip for card links */
[dir="rtl"] .prompt-card-link i.bi-arrow-right {
    transform: scaleX(-1);
}

/* ============ Info Sections (How it works, How AI helps, Danger) ============ */

.prompt-info-sections {
    margin-bottom: 1.5rem;
}

.prompt-info-section {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
}

.prompt-info-section .icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.prompt-info-section strong {
    font-weight: 600;
}

.how-it-works-info .icon {
    color: #017C92;
}

.how-it-works-info strong {
    color: #017C92;
}

.how-ai-helps-info .icon {
    color: #6b5393;
}

.how-ai-helps-info strong {
    color: #6b5393;
}

.danger-info {
    color: #dc3545;
    margin-top: 1rem;
}

.danger-info .icon {
    color: #dc3545;
}

.danger-info strong {
    color: #dc3545;
    font-weight: 600;
}

/* ============ AI Service Buttons (1-click activation) ============ */

.ai-services-section {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ai-services-label {
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.ai-services {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ai-service-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: transform 0.2s ease;
    gap: 0.35rem;
}

.ai-service-btn:hover {
    transform: translateY(-3px);
}

.ai-service-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1.5px solid #e0e0e0;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
    padding: 6px;
}

.ai-service-btn:hover .ai-service-icon {
    border-color: #017C92;
    box-shadow: 0 5px 18px rgba(1, 124, 146, 0.25);
    transform: scale(1.05);
}

.ai-service-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ai-service-label {
    font-size: 0.7rem;
    color: #666;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

/* ============ Responsive ============ */

@media (max-width: 768px) {
    .prompts-hero h1 {
        font-size: 1.75rem;
    }

    .prompts-grid {
        grid-template-columns: 1fr;
    }

    .lang-selector {
        justify-content: center;
    }

    .prompt-detail-wrapper {
        padding: 1rem;
    }

    .prompt-detail-card .card-body {
        padding: 1.5rem;
    }

    .ai-services {
        gap: 0.75rem;
    }

    .ai-service-icon {
        width: 40px;
        height: 40px;
    }
}
