/* CV Builder Frontend Styles */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Encode+Sans:wght@400;600;700&family=Roboto:wght@300;400;500;600&display=swap');

#cv-builder-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 5.3mm;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: 'Roboto', sans-serif;
    font-size: 12pt;
    font-weight: 400;
    color: #333;
}

#cv-builder-form h3 {
    margin-top: 8.5mm;
    margin-bottom: 4.2mm;
    color: #EE0081;
    border-bottom: 2px solid #EE0081;
    padding-bottom: 2.1mm;
    font-size: 22pt;
    font-family: 'Encode Sans', sans-serif;
    font-weight: 700;
}

/* Success Message */
.cv-success-message {
    border-left: 4px solid #46b450;
    background: #f7fcf0;
    padding: 3.2mm;
    margin-bottom: 5.3mm;
    border-radius: 4px;
}


/* Honeypot */
.cv-honeypot {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
}

/* Sections */
.cv-section {
    margin-bottom: 3.2mm;
    padding: 4.2mm;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #ffffff;
}

/* Fields */
.cv-field {
    margin-bottom: 4.2mm;
    position: relative;
}

.cv-label {
    display: block;
    font-weight: 600;
    margin-bottom: 1.6mm;
    color: #333;
    font-family: 'Roboto', sans-serif;
}

.cv-required {
    color: #EE0081;
}

.cv-input {
    width: 100%;
    max-width: 600px;
    padding: 2.1mm 3.2mm;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 10.5pt;
    transition: border-color 0.3s;
}

.cv-input:focus {
    border-color: #EE0081;
    outline: none;
    box-shadow: 0 0 0 2px rgba(238, 0, 129, 0.1);
}

.cv-input.cv-input-error {
    border-color: #d63638 !important;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.1) !important;
}

.cv-field-error {
    display: block;
    color: #d63638;
    font-size: 9.75pt;
    margin-top: 1.1mm;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    line-height: 1.3;
}

.cv-textarea {
    resize: vertical;
    min-height: 21.2mm;
}

.cv-select {
    height: 10.6mm;
}

.cv-checkbox-label {
    font-weight: normal !important;
}

.cv-checkbox {
    width: auto !important;
    margin-right: 2.1mm;
}

/* Repeatable Sections */
.cv-repeatable {
    margin-bottom: 5.3mm;
}

.cv-repeatable-item {
    border: 1px solid #ddd;
    padding: 4.2mm;
    border-radius: 6px;
    margin-bottom: 3.2mm;
    position: relative;
    background: #fff;
}

.cv-remove-item {
    position: absolute;
    top: 2.1mm;
    right: 2.1mm;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 8.5mm;
    height: 8.5mm;
    line-height: 7.9mm;
    text-align: center;
    cursor: pointer;
    font-size: 13.5pt;
    font-weight: bold;
    color: #666;
    transition: all 0.3s;
}

.cv-remove-item:hover {
    background: #d63638;
    color: #fff;
    border-color: #d63638;
}

.cv-add-item {
    background: #3148AD;
    color: #fff;
    border: none;
    padding: 2.6mm 4.2mm;
    border-radius: 9999px;
    cursor: pointer;
    font-size: 12pt;
    font-weight: 600;
    font-family: 'Roboto', sans-serif;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.cv-add-item:hover {
    background: #EE0081;
    transform: translateY(-1px);
}

/* Template Selector */
.cv-template-description {
    margin-bottom: 5.3mm;
    color: #666;
    font-style: italic;
}

.cv-template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5.3mm;
    margin-bottom: 6.3mm;
}

.cv-template-option {
    text-align: center;
}

.cv-template-label {
    cursor: pointer;
    display: block;
    margin-bottom: 2.1mm;
}

.cv-template-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: auto;
    z-index: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    display: none;
}

.cv-template-preview {
    position: relative;
    border: 3px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
}

.cv-template-preview:hover {
    border-color: #EE0081;
    box-shadow: 0 4px 12px rgba(238, 0, 129, 0.15);
}

.cv-template-checkbox:checked + .cv-template-preview,
.cv-template-preview.selected {
    border-color: #EE0081;
    box-shadow: 0 0 0 2px rgba(238, 0, 129, 0.2);
}

.cv-template-checkbox-indicator {
    position: absolute;
    top: 2.6mm;
    right: 2.6mm;
    width: 6.3mm;
    height: 6.3mm;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ddd;
    border-radius: 4px;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cv-template-checkbox:checked + .cv-template-preview .cv-template-checkbox-indicator,
.cv-template-preview.selected .cv-template-checkbox-indicator {
    background: #EE0081;
    border-color: #EE0081;
}

.cv-template-checkbox:checked + .cv-template-preview .cv-template-checkbox-indicator:after,
.cv-template-preview.selected .cv-template-checkbox-indicator:after {
    content: '✓';
    color: white;
    font-weight: bold;
    font-size: 10.5pt;
}

.cv-template-image {
    width: 100%;
    height: 52.9mm;
    object-fit: cover;
    display: block;
    background-color: #f5f5f5;
}

.cv-template-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 4.0mm 2.6mm 2.6mm;
    text-align: center;
}

.cv-template-title {
    font-weight: 600;
    font-size: 12pt;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.cv-template-preview-link {
    display: inline-block;
    margin-top: 2.1mm;
    padding: 1.6mm 3.2mm;
    background: #f8f9fa;
    color: #3148AD;
    text-decoration: none;
    border-radius: 9999px;
    font-size: 9.75pt;
    font-weight: 600;
    border: 1px solid #e5e5e5;
    transition: all 0.3s ease;
    font-family: 'Roboto', sans-serif;
}

.cv-template-preview-link:hover {
    background: #EE0081;
    color: white;
    text-decoration: none;
    border-color: #EE0081;
}

.cv-template-error {
    border-color: #d63638 !important;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.2) !important;
}

/* Submit Section */
.cv-submit-section {
    text-align: center;
    margin-top: 8.5mm;
    padding-top: 5.3mm;
    border-top: 1px solid #e5e5e5;
}

.cv-submit-button {
    background: #3148AD;
    color: #fff;
    border: none;
    padding: 4.2mm 8.5mm;
    font-size: 13.5pt;
    font-weight: 600;
    font-family: 'Encode Sans', sans-serif;
    border-radius: 9999px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(49, 72, 173, 0.3);
}

.cv-submit-button:hover {
    background: #EE0081;
    box-shadow: 0 6px 20px rgba(238, 0, 129, 0.4);
    transform: translateY(-2px);
}

/* Admin Styles */
.cv-admin-section-title {
    margin-top: 6.3mm;
    margin-bottom: 3.2mm;
    color: #333;
}

.cv-admin-table {
    max-width: 100%;
    margin-bottom: 6.3mm;
}

.cv-admin-table tr:not(:last-child) td {
    padding-bottom: 5.3mm;
}

/* Responsive Design */
@media (max-width: 768px) {
    #cv-builder-form {
        margin: 2.6mm;
        padding: 4.0mm;
    }
    
    .cv-input {
        max-width: 100%;
    }
    
    .cv-remove-item {
        width: 7.4mm;
        height: 7.4mm;
        line-height: 6.9mm;
        font-size: 12pt;
    }
    
    .cv-template-grid {
        grid-template-columns: 1fr;
        gap: 4.0mm;
    }
    
    .cv-template-image {
        height: 39.7mm;
    }
}

@media (max-width: 480px) {
    .cv-template-grid {
        gap: 3.2mm;
    }
    
    .cv-template-image {
        height: 31.8mm;
    }
    
    .cv-template-title {
        font-size: 10.5pt;
    }
    
    .cv-template-preview-link {
        font-size: 9pt;
        padding: 1.1mm 2.1mm;
    }
}

/* Modal Styles */
.cv-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cv-modal-overlay.show {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

.cv-modal-content {
    width: 95vw;
    height: 95vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.cv-modal-overlay.show .cv-modal-content {
    transform: scale(1);
}

.cv-modal-header {
    background: linear-gradient(135deg, #3148AD, #5865F2);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.cv-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.cv-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.cv-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.cv-modal-body {
    flex: 1;
    overflow-y: auto;
    background: #f5f5f5;
    position: relative;
}

.cv-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 18px;
    color: #666;
}

.cv-modal-footer {
    background: #f8f9fa;
    padding: 15px 30px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

.cv-modal-close-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.cv-modal-close-btn:hover {
    background: #5a6268;
}

/* Preview content styles */
.cv-preview-content {
    max-width: 210mm;
    margin: 20px auto;
    background: white;
    padding: 8mm;
    box-shadow: 0 0 20px rgba(0,0,0,0.15);
    min-height: 297mm;
    font-family: 'Montserrat', Arial, sans-serif;
}

/* Responsive modal */
@media (max-width: 768px) {
    .cv-modal-content {
        width: 98vw;
        height: 98vh;
        border-radius: 4px;
    }

    .cv-modal-header {
        padding: 15px 20px;
    }

    .cv-modal-header h3 {
        font-size: 18px;
    }

    .cv-modal-close {
        font-size: 24px;
        width: 35px;
        height: 35px;
    }

    .cv-modal-footer {
        padding: 12px 20px;
    }

    .cv-preview-content {
        margin: 10px;
        padding: 4mm;
        min-height: auto;
    }
}

/* Animation keyframes */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Template styles are now loaded dynamically from PHP templates */

/* Modal error styles */
.cv-modal-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 18px;
    color: #e74c3c;
    text-align: center;
    padding: 20px;
}