/**
 * Senna CV Templates - Premium Design System
 * Beautiful template cards and preview system integrated with Senna chat
 */

/* Template Cards Container */
.senna-cv-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px 0;
    margin: 15px 0;
}

/* Alternative grid class name for consistency */
.senna-cv-templates-grid,
.cv-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px 0;
    margin: 15px 0;
}

/* Individual Template Card */
.senna-template-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.senna-template-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #3182ce;
}

/* Template Card Header */
.template-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.template-card-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.template-ats-score {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.template-ats-score.score-excellent { background: linear-gradient(135deg, #48bb78 0%, #38a169 100%); }
.template-ats-score.score-very-good { background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%); }
.template-ats-score.score-good { background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%); }

/* Template Description */
.template-card-description {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

/* Template Meta Information */
.template-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.template-meta-item {
    background: #edf2f7;
    color: #4a5568;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.template-meta-item.industry {
    background: linear-gradient(135deg, #bee3f8 0%, #90cdf4 100%);
    color: #2b6cb0;
}

.template-meta-item.level {
    background: linear-gradient(135deg, #d6f5d6 0%, #9ae6b4 100%);
    color: #276749;
}

/* Template Features List */
.template-features {
    margin-bottom: 20px;
}

.template-features-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
}

.template-features-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.template-feature-tag {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
    color: #22543d;
    border: 1px solid #9ae6b4;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

/* Template Preview Image */
.template-preview {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.template-preview-icon {
    font-size: 24px;
    color: #a0aec0;
}

.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* Template Actions */
.template-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.template-action-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.template-action-btn.primary {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.template-action-btn.primary:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    transform: translateY(-1px);
}

.template-action-btn.secondary {
    background: white;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.template-action-btn.secondary:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

/* Template Categories */
.template-category-filter {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 0 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.category-filter-btn {
    background: white;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.category-filter-btn:hover,
.category-filter-btn.active {
    background: #3182ce;
    color: white;
    border-color: #3182ce;
}

/* Template Loading States */
.template-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #718096;
}

.template-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3182ce;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

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

/* Template Preview Modal */
.template-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.template-preview-modal.active {
    opacity: 1;
    pointer-events: all;
}

.template-preview-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.template-preview-modal.active .template-preview-content {
    transform: scale(1);
}

.template-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #4a5568;
    transition: all 0.2s ease;
}

.template-preview-close:hover {
    background: #edf2f7;
    color: #2d3748;
}

/* Responsive Design */
@media (max-width: 768px) {
    .senna-cv-templates-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px 0;
    }
    
    .senna-template-card {
        padding: 20px;
    }
    
    .template-card-actions {
        flex-direction: column;
    }
    
    .template-action-btn {
        min-width: auto;
    }
    
    .template-category-filter {
        padding: 0 5px;
    }
    
    .template-preview-content {
        margin: 20px;
        padding: 24px;
    }
}

/* Template Type Specific Styling */
.senna-template-card[data-template="executive_classic"] {
    border-left: 4px solid #2b6cb0;
}

.senna-template-card[data-template="finance_powerhouse"] {
    border-left: 4px solid #2d3748;
}

.senna-template-card[data-template="consulting_impact"] {
    border-left: 4px solid #38a169;
}

.senna-template-card[data-template="tech_innovator"] {
    border-left: 4px solid #4299e1;
}

.senna-template-card[data-template="creative_professional"] {
    border-left: 4px solid #ed8936;
}

.senna-template-card[data-template="ats_optimized"] {
    border-left: 4px solid #48bb78;
}

.senna-template-card[data-template="startup_founder"] {
    border-left: 4px solid #e53e3e;
}

.senna-template-card[data-template="academic_scholar"] {
    border-left: 4px solid #805ad5;
}

/* Success States */
.template-selected-success {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
    border: 2px solid #9ae6b4;
    position: relative;
}

.template-selected-success::after {
    content: "✓ Selected";
    position: absolute;
    top: 12px;
    right: 12px;
    background: #38a169;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Chat Integration Styles */
.senna-message .template-card-container {
    margin: 10px 0;
}

/* Senna Service Cards */
.senna-service-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.senna-service-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #cbd5e0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.senna-service-card:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(49, 130, 206, 0.3);
}

.service-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: inherit;
}

.service-card-description {
    font-size: 14px;
    margin: 0;
    opacity: 0.8;
    line-height: 1.4;
}

/* Success Message Styles */
.senna-success-message {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
    border: 1px solid #9ae6b4;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.success-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.success-content {
    flex: 1;
    font-weight: 500;
    color: #22543d;
}

.success-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.success-action-btn {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.success-action-btn:hover {
    background: linear-gradient(135deg, #2f855a 0%, #276749 100%);
    transform: translateY(-1px);
}

/* CV Template Container */
.senna-cv-templates-container {
    margin: 16px 0;
    min-height: 100px;
}

.senna-cv-templates-container .template-header {
    text-align: center;
    margin-bottom: 20px;
}

.senna-cv-templates-container .template-header h3 {
    color: #2d3748;
    font-size: 22px;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.senna-cv-templates-container .template-header p {
    color: #4a5568;
    margin: 0;
    font-size: 16px;
}

.senna-message .template-recommendation {
    background: linear-gradient(135deg, #ebf8ff 0%, #bee3f8 100%);
    border: 1px solid #90cdf4;
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0;
}

.senna-message .template-recommendation-title {
    font-weight: 600;
    color: #2b6cb0;
    margin-bottom: 8px;
}

.senna-message .template-stats {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 12px;
    color: #4a5568;
}

.senna-message .template-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Animation for template loading */
.template-card-enter {
    opacity: 0;
    transform: translateY(20px);
    animation: templateCardEnter 0.4s ease forwards;
}

@keyframes templateCardEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.template-card-enter:nth-child(2) { animation-delay: 0.1s; }
.template-card-enter:nth-child(3) { animation-delay: 0.2s; }
.template-card-enter:nth-child(4) { animation-delay: 0.3s; }