:root {
    --primary-color: #4f46e5;
    --secondary-color: #818cf8;
    --dark-color: #1e1b4b;
    --light-color: #f5f5ff;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-color: #333;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --beginner-color: #10b981;
    --intermediate-color: #f59e0b;
    --advanced-color: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f9fafb;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

section {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--box-shadow);
    display: none;
}

.active-section {
    display: block;
}

h2 {
    color: var(--dark-color);
    margin-bottom: 15px;
}

textarea {
    width: 100%;
    height: 150px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    resize: vertical;
    font-size: 16px;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    transition: background-color 0.3s;
}

button i {
    margin-left: 8px;
}

button:hover {
    background-color: var(--secondary-color);
}

.prompt-example {
    background-color: var(--light-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
}

.prompt-example h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.user-prompt {
    margin-bottom: 20px;
}

.feedback-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-gap: 20px;
    grid-template-areas:
        "score details"
        "skills tips"
        "examples examples";
}

#overall-score {
    grid-area: score;
    text-align: center;
}

#feedback-details {
    grid-area: details;
}

#skill-ratings {
    grid-area: skills;
}

#improvement-tips {
    grid-area: tips;
}

#example-prompts {
    grid-area: examples;
}

.score-circle {
    width: 120px;
    height: 120px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: bold;
    margin: 20px auto;
}

.skill-bars {
    margin-top: 15px;
}

.skill-bar {
    margin-bottom: 15px;
}

.skill-bar .label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.skill-bar .progress {
    height: 10px;
    background-color: #e5e5e5;
    border-radius: 5px;
    overflow: hidden;
}

.skill-bar .progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
}

#tips-list li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
}

#tips-list li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loader-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.hidden {
    display: none !important;
}

.noscript-message {
    background-color: var(--danger-color);
    color: white;
    text-align: center;
    padding: 15px;
    margin: 20px;
    border-radius: var(--border-radius);
}

/* Level selection styles */
.difficulty-levels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.level-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    border-top: 4px solid var(--primary-color);
}

.level-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.level-card[data-level="beginner"] {
    border-top-color: var(--beginner-color);
}

.level-card[data-level="intermediate"] {
    border-top-color: var(--intermediate-color);
}

.level-card[data-level="advanced"] {
    border-top-color: var(--advanced-color);
}

.level-card h3 {
    margin-bottom: 10px;
    color: var(--dark-color);
}

.select-level-btn {
    margin-top: 15px;
    width: 100%;
    justify-content: center;
}

/* Difficulty badge */
.difficulty-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
    color: white;
    background-color: var(--beginner-color);
    margin-bottom: 15px;
}

.difficulty-badge.beginner {
    background-color: var(--beginner-color);
}

.difficulty-badge.intermediate {
    background-color: var(--intermediate-color);
}

.difficulty-badge.advanced {
    background-color: var(--advanced-color);
}

/* Scenario display */
.scenario-display {
    background-color: var(--light-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.6;
}

.scenario-reminder {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
    font-style: italic;
}

/* Action buttons at the bottom of feedback */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* Example better prompts section */
#example-prompts {
    grid-column: 1 / -1;
    margin-top: 20px;
}

#better-prompts {
    background-color: var(--light-color);
    padding: 15px;
    border-radius: var(--border-radius);
}

.example-prompt {
    background-color: white;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    border-left: 4px solid var(--success-color);
}

.example-prompt h4 {
    color: var(--dark-color);
    margin-bottom: 10px;
    font-size: 16px;
}

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

@media (max-width: 768px) {
    .feedback-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "score"
            "details"
            "skills"
            "tips"
            "examples";
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

.select-btn{
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 20px;
}

/* API Settings modal styles */
.settings-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: var(--dark-color);
    padding: 8px 15px;
    font-size: 14px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--dark-color);
}

.api-form {
    margin-top: 20px;
}

.api-form label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}

.api-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    font-size: 14px;
}

.api-info {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.api-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.api-status {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: bold;
}

.api-status.testing {
    background-color: #f8f9fa;
    color: var(--dark-color);
}

.api-status.success {
    background-color: #d1fae5;
    color: var(--success-color);
}

.api-status.error {
    background-color: #fee2e2;
    color: var(--danger-color);
}

#test-api, #save-api-key {
    display: inline-block;
    margin-right: 10px;
}

#save-api-key {
    background-color: var(--success-color);
}

/* API Notification styles */
.api-notification {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 12px 20px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    display: none;
}

.api-notification button {
    background-color: transparent;
    color: var(--primary-color);
    border: none;
    padding: 0;
    margin: 0;
    font-weight: bold;
    display: inline;
    cursor: pointer;
    text-decoration: underline;
}

.api-notification button:hover {
    color: var(--secondary-color);
    background-color: transparent;
}

.api-note {
    color: #dc3545;
    font-size: 14px;
    margin-bottom: 15px;
}

/* Error notification styles */
.error-notification {
    background-color: #feecec;
    border-left: 5px solid var(--danger-color);
    border-radius: var(--border-radius);
    margin: 20px 0;
    padding: 15px;
    box-shadow: var(--box-shadow);
    animation: fadeIn 0.5s;
}

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.error-content i {
    color: var(--danger-color);
    font-size: 2rem;
}

.error-content p {
    margin: 0;
    line-height: 1.5;
}

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

/* API Troubleshooting styles */
.api-troubleshooting {
    background-color: #f8f9fa;
    padding: 15px;
    margin: 15px 0;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--warning-color);
}

.api-troubleshooting h3 {
    margin-top: 0;
    color: var(--dark-color);
    font-size: 16px;
    margin-bottom: 10px;
}

.api-troubleshooting ul {
    margin-left: 20px;
    margin-bottom: 0;
}

.api-troubleshooting li {
    margin-bottom: 5px;
    font-size: 14px;
}

.fallback-button {
    background-color: var(--dark-color);
    width: 100%;
    margin-top: 10px;
}

.api-error-details {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-family: monospace;
    max-height: 80px;
    overflow-y: auto;
    background-color: #f8f9fa;
    padding: 5px;
    border-radius: 3px;
}

/* Context container styles */
.context-container {
    margin: 15px 0 20px;
}

.context-toggle button {
    background-color: transparent;
    color: var(--primary-color);
    font-size: 14px;
    padding: 5px 10px;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
}

.context-toggle button:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

.context-details {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-top: 10px;
    border-left: 4px solid var(--primary-color);
}

#skills-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
}

#skills-list span {
    background-color: var(--light-color);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Prompt guidance styles */
.prompt-guidance {
    background-color: #f1f5f9;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 25px;
    border-left: 4px solid var(--primary-color);
}

.guidance-header {
    margin-bottom: 15px;
}

.guidance-header h4 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.examples {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

@media (min-width: 768px) {
    .examples {
        flex-direction: row;
    }
    
    .bad-example, .good-example {
        flex: 1;
    }
}

.bad-example, .good-example {
    padding: 15px;
    border-radius: var(--border-radius);
    transition: opacity 0.3s ease;
}

.bad-example {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.good-example {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.bad-example h5, .good-example h5 {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.bad-example h5 i {
    color: var(--danger-color);
    margin-right: 8px;
}

.good-example h5 i {
    color: var(--success-color);
    margin-right: 8px;
}

.guidance-note {
    font-style: italic;
    font-size: 14px;
    color: #64748b;
}

.example-tip {
    margin-top: 10px;
    text-align: right;
}

.subtle-button {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.2s ease;
}

.subtle-button:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

.subtle-button i {
    margin-right: 5px;
    margin-left: 0;
    font-size: 10px;
}

/* Instruction text styles */
.instruction-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}
