/* Prompt Playground Styles */
.tool-header {
    margin-bottom: 30px;
}

.breadcrumb {
    margin-bottom: 20px;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.tool-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 800px;
    line-height: 1.6;
}

.playground-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .playground-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Prompt Section */
.prompt-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.prompt-header h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.prompt-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#templateSelect {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--background);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.prompt-categories {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    overflow-x: auto;
}

.category-btn {
    padding: 8px 15px;
    border: none;
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.category-btn:hover {
    background: var(--primary-color);
    color: white;
}

.category-btn.active {
    background: var(--primary-color);
    color: white;
}

#promptInput {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    background: var(--background);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
    margin-bottom: 15px;
}

#promptInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.prompt-analysis {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 10px;
}

.analysis-metrics {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.prompt-tips {
    color: var(--primary-color);
    font-style: italic;
    text-align: right;
    flex: 1;
    min-width: 200px;
}

/* Response Section */
.response-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.response-header h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.response-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.response-container {
    min-height: 200px;
    margin-bottom: 20px;
}

.response-status {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    background: var(--background);
    border-radius: 8px;
    color: var(--text-secondary);
    font-style: italic;
    border: 2px dashed var(--border-color);
}

.ai-response {
    background: var(--background);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-color);
    min-height: 150px;
    white-space: pre-wrap;
    line-height: 1.6;
    display: none;
}

.response-analysis {
    background: var(--background);
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid var(--primary-color);
}

.response-analysis h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.response-metrics {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    min-width: 100px;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Templates */
.prompt-templates {
    background: var(--surface);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.prompt-templates h3 {
    font-size: 1.4rem;
    margin-bottom: 25px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.template-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.template-category {
    background: var(--background);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.template-category h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

.category-templates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.template-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.template-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

.template-card h5 {
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.template-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Prompt Optimization Lab */
.prompt-optimization {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.prompt-optimization h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.optimization-tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.optimization-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.optimization-card h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.length-analysis {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.length-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.metric-value {
    font-weight: 600;
    color: var(--primary-color);
}

.length-recommendation {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    padding: 8px;
    background: var(--background);
    border-radius: 6px;
}

.style-options, .quick-templates {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.style-btn, .quick-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--background);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.style-btn:hover, .quick-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Conversation History */
.conversation-history {
    background: var(--surface);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.history-header h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.empty-history {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 40px 20px;
    background: var(--background);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
}

.history-item {
    background: var(--background);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--border-color);
    position: relative;
}

.history-prompt {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.history-response {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-timestamp {
    font-size: 0.8rem;
    color: var(--text-secondary);
    position: absolute;
    top: 10px;
    right: 10px;
}

.history-controls {
    display: flex;
    gap: 5px;
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.history-btn {
    padding: 4px 8px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* Educational Info */
.educational-info {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    padding: 30px;
    border: 1px solid var(--border-color);
}

.educational-info h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.learning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.learning-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
}

.learning-card h4 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.learning-card p {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.example-toggle {
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    text-align: center;
}

.example-toggle:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.card-example {
    margin-top: 15px;
    padding: 12px;
    background: var(--background);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    line-height: 1.4;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

/* Prompt Techniques */
.prompt-techniques {
    background: var(--surface);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid var(--border-color);
}

.prompt-techniques h4 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.techniques-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.technique {
    padding: 15px;
    background: var(--background);
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
    border: 1px solid var(--border-color);
    line-height: 1.5;
}

.technique strong {
    color: var(--success-color);
    display: block;
    margin-bottom: 5px;
}

/* Loading States */
.generating {
    opacity: 0.7;
    pointer-events: none;
}

.generating .response-status::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .prompt-header {
        flex-direction: column;
        align-items: stretch;
    }

    .prompt-controls {
        justify-content: center;
    }

    .response-header {
        flex-direction: column;
        align-items: stretch;
    }

    .response-controls {
        justify-content: center;
    }

    .response-metrics {
        justify-content: center;
    }

    .history-header {
        flex-direction: column;
        align-items: stretch;
    }

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

    .category-templates {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .optimization-tools {
        grid-template-columns: 1fr;
    }

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

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

    .style-options, .quick-templates {
        justify-content: center;
    }
}
