/**
 * PsihoProfile AI Interpreter Frontend Styles - v11.0 SCALABLE
 * CHANGES v11.0:
 * - Fixed CSS specificity with !important rules
 * - Added all dynamic category color classes
 * - Soft skills matching professional profile page
 * - Backwards compatible with old category names
 */

/* CSS Variables - Matching Job Search */
.psihoprofile-ai-summary-container {
    --sp-primary: #0292B7;
    --sp-secondary: #1AC8DB;
    --sp-accent: #e8f4f8;
    --sp-dark: #2d3748;
    --sp-text: #4a5568;
    --sp-gray: #718096;
    --sp-light-gray: #f7fafc;
    --sp-border: #e2e8f0;
    --sp-white: #ffffff;
    --sp-success: #48bb78;
    --sp-success-light: #c6f6d5;
    --sp-error: #e53e3e;
    --sp-error-light: #fed7d7;
    --sp-warning: #ed8936;
    --sp-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --sp-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --sp-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --sp-radius: 12px;
    --sp-radius-sm: 8px;
    --sp-transition: all 0.2s ease;
}

/* --- Base Container Styles --- */
.psihoprofile-ai-summary-container {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border: 1px solid var(--sp-border);
    padding: 20px;
    margin: 20px 0;
    background-color: var(--sp-light-gray);
    border-radius: var(--sp-radius);
    line-height: 1.5;
    font-size: 14px;
    color: var(--sp-dark);
}

.psihoprofile-ai-summary-container * {
    box-sizing: border-box;
}

/* --- Generate Button --- */
.psihoprofile-ai-generate-button {
    background: linear-gradient(135deg, var(--sp-primary) 0%, var(--sp-secondary) 100%);
    color: var(--sp-white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    transition: var(--sp-transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--sp-shadow-sm);
}

.psihoprofile-ai-generate-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--sp-shadow-md);
}

.psihoprofile-ai-generate-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* --- Main Result Container --- */
.psihoprofile-ai-result {
    margin-top: 15px !important;
    padding: 0 !important;
    border-top: none !important;
    background-color: transparent !important;
    border-radius: var(--sp-radius) !important;
}

/* --- AI Interpretation Sections - BASE STYLES --- */
.psihoprofile-ai-section {
    margin-bottom: 15px !important;
    line-height: 1.7 !important;
    padding: 16px 18px !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.2s ease !important;
    display: block !important;
}

.psihoprofile-ai-section:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-1px);
}

.psihoprofile-ai-section h4 {
    font-size: 15px !important;
    font-weight: 700 !important;
    margin: 0 0 10px 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    line-height: 1.4 !important;
}

.psihoprofile-ai-section h4 .dashicons {
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
}

.psihoprofile-ai-section p {
    color: #1a1a1a !important;
    font-size: 14px !important;
    line-height: 1.7 !important;
    margin: 0 !important;
}

/* =====================================================
   SECTION-SPECIFIC COLORS - OLD CATEGORIES (backwards compatible)
   These match the EXACT keys stored in database from v10.x
   ===================================================== */
.psihoprofile-ai-section.general {
    background: #e7f3fe !important;
    border-left: 4px solid #0292B7 !important;
}

.psihoprofile-ai-section.stil_invatare {
    background: #f3e8ff !important;
    border-left: 4px solid #a855f7 !important;
}

.psihoprofile-ai-section.mediu {
    background: #ecfdf5 !important;
    border-left: 4px solid #10b981 !important;
}

.psihoprofile-ai-section.colegi {
    background: #e0e7ff !important;
    border-left: 4px solid #6366f1 !important;
}

.psihoprofile-ai-section.recomandari {
    background: #fef3c7 !important;
    border-left: 4px solid #f59e0b !important;
}

.psihoprofile-ai-section.business {
    background: #d1fae5 !important;
    border-left: 4px solid #14b8a6 !important;
}

/* Also support the old CSS class names (learning, environment, etc.) */
.psihoprofile-ai-section.learning {
    background: #f3e8ff !important;
    border-left: 4px solid #a855f7 !important;
}

.psihoprofile-ai-section.environment {
    background: #ecfdf5 !important;
    border-left: 4px solid #10b981 !important;
}

.psihoprofile-ai-section.colleagues {
    background: #e0e7ff !important;
    border-left: 4px solid #6366f1 !important;
}

.psihoprofile-ai-section.recommendations {
    background: #fef3c7 !important;
    border-left: 4px solid #f59e0b !important;
}

/* =====================================================
   SECTION-SPECIFIC COLORS - NEW DYNAMIC CATEGORIES v11.0
   ===================================================== */

/* Communication & Content */
.psihoprofile-ai-section.communication_style {
    background: #eff6ff !important;
    border-left: 4px solid #3b82f6 !important;
}

.psihoprofile-ai-section.content_creation {
    background: #f5f3ff !important;
    border-left: 4px solid #8b5cf6 !important;
}

/* Analytical & Problem Solving */
.psihoprofile-ai-section.analytical_approach {
    background: #e0f7fa !important;
    border-left: 4px solid #0292B7 !important;
}

.psihoprofile-ai-section.problem_solving {
    background: #ecfdf5 !important;
    border-left: 4px solid #059669 !important;
}

/* Visual & Design */
.psihoprofile-ai-section.visual_thinking {
    background: #f5f3ff !important;
    border-left: 4px solid #8b5cf6 !important;
}

.psihoprofile-ai-section.design_potential {
    background: #fdf2f8 !important;
    border-left: 4px solid #ec4899 !important;
}

/* Physical & Hands-on */
.psihoprofile-ai-section.physical_intelligence {
    background: #fffbeb !important;
    border-left: 4px solid #f59e0b !important;
}

.psihoprofile-ai-section.hands_on_approach {
    background: #fff7ed !important;
    border-left: 4px solid #ea580c !important;
}

/* Musical & Auditory */
.psihoprofile-ai-section.rhythmic_patterns {
    background: #fdf2f8 !important;
    border-left: 4px solid #ec4899 !important;
}

.psihoprofile-ai-section.auditory_learning {
    background: #faf5ff !important;
    border-left: 4px solid #a855f7 !important;
}

/* Interpersonal */
.psihoprofile-ai-section.team_dynamics {
    background: #ecfdf5 !important;
    border-left: 4px solid #10b981 !important;
}

.psihoprofile-ai-section.leadership_potential {
    background: #f0fdfa !important;
    border-left: 4px solid #14b8a6 !important;
}

.psihoprofile-ai-section.emotional_intelligence {
    background: #fff1f2 !important;
    border-left: 4px solid #f43f5e !important;
}

/* Intrapersonal */
.psihoprofile-ai-section.self_awareness {
    background: #eef2ff !important;
    border-left: 4px solid #6366f1 !important;
}

.psihoprofile-ai-section.personal_growth {
    background: #f5f3ff !important;
    border-left: 4px solid #8b5cf6 !important;
}

/* Naturalistic */
.psihoprofile-ai-section.pattern_recognition {
    background: #ecfdf5 !important;
    border-left: 4px solid #059669 !important;
}

.psihoprofile-ai-section.environmental_awareness {
    background: #f0fdf4 !important;
    border-left: 4px solid #16a34a !important;
}

/* Common categories (always shown) */
.psihoprofile-ai-section.mediu_lucru {
    background: #ecfdf5 !important;
    border-left: 4px solid #10b981 !important;
}

.psihoprofile-ai-section.recomandari {
    background: #fef3c7 !important;
    border-left: 4px solid #f59e0b !important;
}

.psihoprofile-ai-section.valoare_business {
    background: #d1fae5 !important;
    border-left: 4px solid #14b8a6 !important;
}

/* =====================================================
   SOFT SKILLS - MATCHING PROFESSIONAL PROFILE EXACTLY
   ===================================================== */
.psihoprofile-report-soft-skills {
    margin-top: 25px;
    padding: 25px;
    background: var(--sp-white);
    border-radius: var(--sp-radius);
    border: 1px solid var(--sp-border);
    box-shadow: var(--sp-shadow-sm);
}

.psihoprofile-report-soft-skills h4 {
    color: var(--sp-primary);
    margin: 0 0 6px 0;
    text-align: left;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.psihoprofile-soft-skills-subtitle {
    text-align: left;
    color: var(--sp-gray);
    font-size: 13px;
    margin: 0 0 18px 0;
}

/* Skills Grid - MATCHING PROFESSIONAL PROFILE EXACTLY */
.psihoprofile-soft-skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
}

/* Individual Skill Badge - MATCHING PROFESSIONAL PROFILE EXACTLY */
.psihoprofile-skill-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 20px;
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: var(--sp-transition);
    border: 1px solid rgba(0, 0, 0, 0.08);
    cursor: default;
}

.psihoprofile-skill-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--sp-shadow-md);
}

/* Max Points Badge - Larger styling for highest skill */
.psihoprofile-skill-badge-max {
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: var(--sp-shadow-sm);
}

.psihoprofile-skill-badge-max:hover {
    transform: translateY(-2px);
    box-shadow: var(--sp-shadow-md);
}

/* Skill Name */
.psihoprofile-skill-badge .skill-name {
    font-size: 14px;
    color: #1a1a1a;
    font-weight: 600;
}

.psihoprofile-skill-badge-max .skill-name {
    font-size: 15px;
    font-weight: 700;
}

/* Skill Points */
.psihoprofile-skill-badge .skill-points {
    background: rgba(0, 0, 0, 0.1);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #1a1a1a;
}

.psihoprofile-skill-badge-max .skill-points {
    font-size: 13px;
    padding: 4px 9px;
}

/* --- Loading States --- */
.psihoprofile-ai-loading,
.psihoprofile-ai-error-msg,
.psihoprofile-ai-error {
    margin-top: 10px;
    padding: 15px;
    border-radius: var(--sp-radius-sm);
}

.psihoprofile-ai-error,
.psihoprofile-ai-error-msg {
    color: var(--sp-error);
    font-weight: 600;
    background: var(--sp-error-light);
    border-left: 4px solid var(--sp-error);
    font-size: 13px;
}

.psihoprofile-ai-loading {
    text-align: center;
    padding: 40px 20px;
    background: var(--sp-accent);
    border: 2px solid var(--sp-primary);
    border-radius: var(--sp-radius);
    animation: pulseLoading 2s ease-in-out infinite;
}

.psihoprofile-ai-loading p {
    margin: 15px 0 0 0;
    color: #0c5460;
    font-size: 14px;
    line-height: 1.6;
    font-weight: 500;
}

.psihoprofile-ai-loading .spinner {
    border: 4px solid var(--sp-light-gray);
    border-top: 4px solid var(--sp-primary);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin: 0 auto;
}

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

@keyframes pulseLoading {
    0%, 100% { 
        border-color: var(--sp-primary); 
        background: var(--sp-accent);
    }
    50% { 
        border-color: var(--sp-secondary); 
        background: #d4edfa;
    }
}

/* --- Success Message --- */
.psihoprofile-ai-success {
    color: var(--sp-success) !important;
    background: var(--sp-success-light);
    border-left: 4px solid var(--sp-success);
    padding: 12px 16px;
    border-radius: var(--sp-radius-sm);
    font-weight: 600;
    font-size: 13px;
}

/* --- Search Form --- */
.psihoprofile-career-search-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.psihoprofile-career-search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius-sm);
    font-size: 14px;
    transition: var(--sp-transition);
    background: var(--sp-white);
}

.psihoprofile-career-search-input:focus {
    outline: none;
    border-color: var(--sp-primary);
    box-shadow: 0 0 0 3px rgba(2, 146, 183, 0.1);
}

.psihoprofile-career-search-btn {
    background: linear-gradient(135deg, var(--sp-primary) 0%, var(--sp-secondary) 100%);
    color: var(--sp-white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--sp-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--sp-transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.psihoprofile-career-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--sp-shadow-md);
}

/* --- Data Notes --- */
.psihoprofile-data-note {
    background: var(--sp-accent);
    border-left: 4px solid var(--sp-primary);
    padding: 14px 18px;
    margin: 15px 0;
    color: #0c5460;
    border-radius: var(--sp-radius-sm);
    font-size: 13px;
}

.psihoprofile-results-heading {
    font-size: 1.1em;
    color: var(--sp-dark);
    margin-top: 20px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--sp-border);
    font-weight: 600;
}

.psihoprofile-section-title {
    font-size: 1.3em;
    color: var(--sp-dark);
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--sp-primary);
    font-weight: 700;
}

/* --- Tables --- */
.psihoprofile-user-career-match-table,
.psihoprofile-popular-careers-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 13px;
    background: var(--sp-white);
    border-radius: var(--sp-radius-sm);
    overflow: hidden;
    box-shadow: var(--sp-shadow-sm);
}

.psihoprofile-user-career-match-table th,
.psihoprofile-user-career-match-table td,
.psihoprofile-popular-careers-table th,
.psihoprofile-popular-careers-table td {
    border: 1px solid var(--sp-border);
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
}

.psihoprofile-user-career-match-table th,
.psihoprofile-popular-careers-table th {
    background-color: var(--sp-light-gray);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sp-dark);
}

.psihoprofile-user-career-match-table tbody tr:hover,
.psihoprofile-popular-careers-table tbody tr:hover {
    background-color: var(--sp-accent);
}

.psihoprofile-user-avatar {
    border-radius: 50%;
    border: 2px solid var(--sp-border);
    margin-right: 10px;
    vertical-align: middle;
}

.psihoprofile-user-name {
    font-weight: 600;
    color: var(--sp-dark);
}

.psihoprofile-percentage-cell {
    text-align: center;
    font-weight: 700;
    color: var(--sp-primary);
}

.psihoprofile-count-cell {
    text-align: center;
    font-weight: 600;
}

.psihoprofile-popular-career-link {
    color: var(--sp-primary);
    text-decoration: none;
    cursor: pointer;
    transition: var(--sp-transition);
    font-weight: 600;
}

.psihoprofile-popular-career-link:hover {
    color: var(--sp-secondary);
    text-decoration: underline;
}

/* --- Dashboard Layout --- */
.psihoprofile-career-dashboard {
    background-color: var(--sp-white);
    padding: 25px;
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow-md);
    margin: 25px 0;
    border: 1px solid var(--sp-border);
}

.psihoprofile-career-dashboard > h1 {
    text-align: center;
    color: var(--sp-dark);
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 1.6em;
    border-bottom: 2px solid var(--sp-primary);
    padding-bottom: 15px;
    font-weight: 700;
}

.psihoprofile-dashboard-section {
    background-color: var(--sp-light-gray);
    padding: 20px;
    margin-bottom: 25px;
    border-radius: var(--sp-radius-sm);
    border: 1px solid var(--sp-border);
}

.psihoprofile-dashboard-section:last-child {
    margin-bottom: 0;
}

#dashboard-charts .psihoprofile-section-title {
    text-align: center;
    border-bottom-width: 1px;
}

.psihoprofile-charts-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-around;
    margin-top: 20px;
}

.psihoprofile-chart-wrapper {
    flex: 1 1 400px;
    min-width: 300px;
    padding: 18px;
    background-color: var(--sp-white);
    border-radius: var(--sp-radius-sm);
    box-shadow: var(--sp-shadow-sm);
    height: 350px;
    border: 1px solid var(--sp-border);
}

.psihoprofile-chart-wrapper h3 {
    text-align: center;
    font-size: 1em;
    color: var(--sp-dark);
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 700;
}

/* --- Modal Styles --- */
.psihoprofile-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.psihoprofile-modal-content {
    background-color: var(--sp-white);
    margin: 8% auto;
    padding: 0;
    border: none;
    width: 90%;
    max-width: 600px;
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow-lg);
    position: relative;
    animation-name: psmodalopen;
    animation-duration: 0.3s;
    overflow: hidden;
}

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

.psihoprofile-modal-close {
    color: var(--sp-gray);
    position: absolute;
    right: 15px;
    top: 12px;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: var(--sp-transition);
    z-index: 10;
}

.psihoprofile-modal-close:hover,
.psihoprofile-modal-close:focus {
    color: var(--sp-dark);
}

.psihoprofile-modal-content h3 {
    margin: 0;
    color: var(--sp-dark);
    padding: 18px 20px;
    background: var(--sp-light-gray);
    border-bottom: 1px solid var(--sp-border);
    font-size: 1.1em;
    font-weight: 700;
}

.psihoprofile-modal-user-list-container {
    max-height: 350px;
    overflow-y: auto;
    padding: 15px 20px;
}

.psihoprofile-modal-user-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--sp-border);
    transition: var(--sp-transition);
}

.psihoprofile-modal-user-item:hover {
    background: var(--sp-accent);
    margin: 0 -10px;
    padding: 10px;
    border-radius: var(--sp-radius-sm);
}

.psihoprofile-modal-user-item:last-child {
    border-bottom: none;
}

.psihoprofile-modal-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    margin-right: 14px;
    object-fit: cover;
    border: 2px solid var(--sp-border);
}

.psihoprofile-modal-user-name {
    flex-grow: 1;
    font-size: 14px;
    color: var(--sp-dark);
    font-weight: 600;
}

.psihoprofile-modal-user-percentage {
    font-weight: 700;
    font-size: 14px;
    color: var(--sp-primary);
    min-width: 50px;
    text-align: right;
}

/* --- Responsive Design --- */
@media (max-width: 767px) {
    .psihoprofile-ai-summary-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    .psihoprofile-soft-skills-grid {
        gap: 8px;
    }
    
    .psihoprofile-skill-badge {
        padding: 8px 12px;
        font-size: 12px;
        gap: 6px;
    }
    
    .psihoprofile-skill-badge .skill-name {
        font-size: 12px;
    }
    
    .psihoprofile-skill-badge .skill-points {
        padding: 2px 6px;
        font-size: 10px;
    }
    
    .psihoprofile-skill-badge-max {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .psihoprofile-skill-badge-max .skill-name {
        font-size: 13px;
    }
    
    .psihoprofile-skill-badge-max .skill-points {
        font-size: 11px;
        padding: 2px 7px;
    }
    
    .psihoprofile-charts-container {
        flex-direction: column;
        align-items: center;
    }
    
    .psihoprofile-chart-wrapper {
        width: 100%;
        max-width: 450px;
        flex-basis: auto;
        height: 280px;
    }
    
    .psihoprofile-career-dashboard > h1 {
        font-size: 1.3em;
    }
    
    .psihoprofile-section-title {
        font-size: 1.1em;
    }
    
    .psihoprofile-modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .psihoprofile-career-search-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .psihoprofile-career-search-input {
        width: 100%;
    }
    
    .psihoprofile-ai-section h4 {
        font-size: 14px;
    }
    
    .psihoprofile-ai-section p {
        font-size: 13px;
    }
    
    .psihoprofile-ai-generate-button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .psihoprofile-skill-badge {
        padding: 6px 10px;
        font-size: 11px;
        gap: 5px;
    }
    
    .psihoprofile-skill-badge .skill-name {
        font-size: 11px;
    }
    
    .psihoprofile-skill-badge .skill-points {
        padding: 1px 5px;
        font-size: 9px;
    }
    
    .psihoprofile-skill-badge-max {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .psihoprofile-skill-badge-max .skill-name {
        font-size: 12px;
    }
    
    .psihoprofile-skill-badge-max .skill-points {
        font-size: 10px;
        padding: 2px 6px;
    }
}