/* Template Selection Styles */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.template-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.template-item:hover {
    border-color: #4A90E2;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
    transform: translateY(-2px);
}

.template-item.selected {
    border-color: #4A90E2;
    background-color: #f0f7ff;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.template-preview {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Fallback handled by SVG */
.template-preview svg {
    display: block;
}

.template-info h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.25rem;
}

.template-info p {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Preview Controls */
.preview-controls {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-bottom: 1rem;
    flex-shrink: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.btn-refresh,
.btn-download {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-refresh {
    background: #f5f5f5;
    color: #333;
}

.btn-refresh:hover {
    background: #e0e0e0;
}

.btn-download {
    background: #4A90E2;
    color: white;
}

.btn-download:hover {
    background: #357ABD;
}

.preview-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Wspólne style dla wszystkich szablonów */
.cv-template {
    padding: 20px;
    max-width: 100%;
    margin: 0 auto;
    font-family: Arial, sans-serif;
    font-size: 0.9em;
    word-wrap: break-word;
}

.cv-template h1, .cv-template h2, .cv-template h3 {
    margin: 0;
    padding: 0;
    word-wrap: break-word;
}

/* Modern Template */
.cv-template-modern {
    color: #333;
}

.cv-template-modern .cv-header {
    text-align: center;
    margin-bottom: 30px;
}

.cv-template-modern h1 {
    font-size: 1.8em;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.cv-template-modern .job-title-target {
    font-size: 1.2em;
    color: #555;
    font-weight: 500;
    margin-top: -8px;
    margin-bottom: 12px;
}
.cv-template-modern .contact-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cv-template-modern .contact-info p {
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cv-template-modern section {
    margin-bottom: 30px;
}

.cv-template-modern h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
    margin-bottom: 15px;
}

/* Creative Template */
.cv-template-creative {
    color: #333;
}

.cv-template-creative .creative-header {
    background: var(--primary-color);
    color: white;
    padding: 40px;
    margin: -30px -30px 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.cv-template-creative h1 {
    font-size: 2em;
    line-height: 1.1;
    margin: 0;
}

/* CV photo (shared) */
.cv-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.cv-template-modern .cv-photo {
    margin: 0 auto 12px;
    border: 3px solid var(--primary-color);
}

.cv-template-creative .cv-photo {
    width: 90px;
    height: 90px;
    border: 3px solid rgba(255,255,255,0.9);
    margin-bottom: 12px;
}

.cv-template-creative .job-title-target {
    font-size: 1.05em;
    color: rgba(255,255,255,0.95);
    margin-top: 8px;
}
.cv-template-creative .creative-contact {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.cv-template-creative .contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cv-template-creative h2 {
    color: var(--primary-color);
    font-size: 1.8em;
    margin-bottom: 20px;
    position: relative;
    padding-left: 20px;
}

.cv-template-creative h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
}

/* Common sections styling */
.experience-entry, .education-entry {
    margin-bottom: 20px;
}

.job-header, .education-details {
    margin-bottom: 8px;
}

.job-period, .education-period {
    color: var(--secondary-color);
    font-size: 0.9em;
}

.company-name {
    color: var(--secondary-color);
    font-weight: bold;
}

.skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skill-item {
    background: #f8f9fa;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
}

.social-links {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.social-links a {
    color: var(--primary-color);
    font-size: 1.2em;
    text-decoration: none;
}

.social-links a:hover {
    color: var(--secondary-color);
}

/* Languages Section */
.cv-languages {
    margin-top: 30px;
}

.languages-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.language-entry {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.language-entry strong {
    color: var(--primary-color);
    font-size: 1em;
}

.language-level {
    font-size: 0.85em;
    color: #6c757d;
}

/* Certifications Section */
.cv-certifications {
    margin-top: 30px;
}

.certifications-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.certification-entry {
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.certification-entry strong {
    display: block;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.cert-issuer {
    font-size: 0.9em;
    color: #495057;
    margin-bottom: 5px;
}

.cert-details {
    display: flex;
    gap: 15px;
    font-size: 0.85em;
    color: #6c757d;
}

.cert-number {
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cv-template {
        padding: 20px;
    }

    .cv-template-creative .creative-header {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .cv-template-modern .contact-info {
        flex-direction: column;
        align-items: center;
    }
}