/* CV Builder Tool Styles - Vertical Layout with Sticky Preview */

/* Settings Grid */
.cv-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.cv-setting-item {
    display: flex;
    flex-direction: column;
}

/* Experience, Education, Language Entry Styles */
.experience-entry,
.education-entry,
.language-entry {
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .experience-entry,
[data-bs-theme="dark"] .education-entry,
[data-bs-theme="dark"] .language-entry {
    background-color: #2b3035 !important;
}

.experience-entry:hover,
.education-entry:hover,
.language-entry:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Static Preview Section (Non-Sticky) */
.cv-static-preview {
    margin-top: 30px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.cv-preview-header {
    background: linear-gradient(135deg, #052c65 0%, #084298 100%);
    color: white;
    padding: 15px 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

/* Sticky Preview Overlay */
.cv-sticky-preview-overlay {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 450px;
    max-width: calc(100vw - 40px);
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: stickySlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

@keyframes stickySlideIn {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.cv-sticky-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #052c65 0%, #084298 100%);
    color: white;
    padding: 12px 16px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.cv-sticky-preview-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.cv-sticky-preview-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.cv-sticky-preview-close:active {
    transform: scale(0.95);
}

.cv-preview-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.cv-preview-content {
    background: #ffffff;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
    min-height: 400px;
}

.cv-sticky-preview-content {
    padding: 16px;
    background: #ffffff;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

/* Ensure preview content always has white background */
#previewContainer,
#stickyPreviewContent {
    background: #ffffff !important;
}

[data-bs-theme="dark"] .cv-preview-content,
[data-bs-theme="dark"] .cv-sticky-preview-content {
    background: #ffffff !important;
}

[data-bs-theme="dark"] #previewContainer,
[data-bs-theme="dark"] #stickyPreviewContent {
    background: #ffffff !important;
}

/* CV Template Styles */
.cv-modern,
.cv-classic {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    color: #333;
}

.cv-modern h1,
.cv-modern h2,
.cv-modern h3 {
    font-weight: 600;
}

.cv-classic h1,
.cv-classic h2,
.cv-classic h3 {
    font-weight: 700;
}

/* Section Headers */
h6 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
}

/* Form Spacing */
.mb-2 {
    margin-bottom: 1rem !important;
}

/* Entry Remove Button */
.experience-entry .btn-outline-danger,
.education-entry .btn-outline-danger,
.language-entry .btn-outline-danger {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* Buttons */
.toolBtn {
    font-size: 0.9rem;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.toolBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Custom Scrollbar for Preview */
.cv-preview-content::-webkit-scrollbar {
    width: 8px;
}

.cv-preview-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.cv-preview-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.cv-preview-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .cv-settings-grid {
        grid-template-columns: 1fr;
    }

    .cv-static-preview {
        margin-top: 20px;
    }

    .cv-preview-content {
        max-height: 500px;
    }

    .cv-sticky-preview-overlay {
        top: 60px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }

    .cv-sticky-preview-content {
        max-height: calc(100vh - 140px);
    }

    .cv-modern h1 {
        font-size: 24px !important;
    }

    .cv-modern h2 {
        font-size: 16px !important;
    }

    .cv-classic h1 {
        font-size: 22px !important;
    }

    .cv-classic h2 {
        font-size: 14px !important;
    }
}

/* Mobile Button Layout */
@media (max-width: 576px) {
    .d-flex.flex-wrap.gap-2 {
        flex-direction: column;
    }

    .d-flex.flex-wrap.gap-2 .btn {
        width: 100%;
    }
}

/* Form Controls */
.form-label {
    font-weight: 500;
    margin-bottom: 0.375rem;
    font-size: 0.9rem;
}

.form-label.small {
    font-size: 0.85rem;
}

.form-label.fw-semibold {
    font-weight: 600;
}

/* Required Field Indicator */
.text-danger {
    font-weight: 700;
    color: #dc3545;
}

/* Loading State */
#loadingSpinner .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
}

/* Preview Empty State */
.cv-preview-content .text-center.text-muted {
    padding: 60px 20px;
}

.cv-preview-content .text-center.text-muted img {
    opacity: 0.2;
}

/* Better Textarea Sizing */
textarea.toolInput {
    resize: vertical;
    min-height: 60px;
}

/* Input Focus States */
.cv-auto-update:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(5, 44, 101, 0.15);
}

/* Ensure proper line breaking in CV */
.cv-modern p,
.cv-classic p {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Skills Display in Preview */
.cv-modern span[style*="background: #f0f0f0"] {
    display: inline-block;
}

/* Dark Mode Adjustments */
[data-bs-theme="dark"] .cv-static-preview {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .cv-preview-header {
    background: linear-gradient(135deg, #052c65 0%, #084298 100%);
}

[data-bs-theme="dark"] .cv-sticky-preview-overlay {
    background: var(--bs-body-bg);
    border-color: #343a40;
}

[data-bs-theme="dark"] .cv-sticky-preview-header {
    background: linear-gradient(135deg, #052c65 0%, #084298 100%);
    border-color: #343a40;
}

[data-bs-theme="dark"] .cv-sticky-preview-content {
    background: #ffffff !important;
}

[data-bs-theme="dark"] .cv-sticky-preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Smooth Transitions */
.card,
.btn,
.experience-entry,
.education-entry,
.language-entry {
    transition: all 0.2s ease-in-out;
}

/* Icon Alignment */
.fsvg {
    vertical-align: middle;
    display: inline-block;
}

/* Gap Utility */
.gap-2 {
    gap: 0.5rem !important;
}

/* Text Primary for Entry Headers */
.text-primary {
    color: var(--bs-primary-text-emphasis) !important;
}

/* Compact Form Controls in Entries */
.form-control-sm,
.form-select-sm {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* Row Gutters */
.row.g-2 {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
}

/* Checkbox Alignment */
.form-check-input {
    margin-top: 0.25rem;
}

.form-check-label {
    cursor: pointer;
}

/* Hover Effects for Buttons */
.btn-outline-primary:hover {
    transform: none;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Sticky Preview Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cv-sticky-preview {
    animation: slideIn 0.3s ease-out;
}

/* Preview Content Transition */
#previewContainer {
    transition: opacity 0.2s ease;
}

/* Print Styles for PDF Generation */
@media print {
    .cv-modern,
    .cv-classic {
        padding: 0;
        margin: 0;
        box-shadow: none;
    }

    .cv-preview-content {
        padding: 0;
        box-shadow: none;
        border: none;
    }
}

/* Form Section Spacing */
.form_tool > form > div.mb-2:last-of-type {
    margin-bottom: 1.5rem !important;
}

/* Settings Grid on Tablet */
@media (min-width: 768px) and (max-width: 991px) {
    .cv-settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Desktop */
@media (min-width: 1400px) {
    .cv-preview-content {
        max-height: 700px;
    }
}

/* Button Group Spacing */
.d-flex.gap-2 {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Improve Entry Visual Hierarchy */
.experience-entry strong,
.education-entry strong,
.language-entry strong {
    font-size: 0.95rem;
}

/* Better Border Radius */
.experience-entry,
.education-entry,
.language-entry {
    border-radius: 6px;
}

.cv-sticky-preview {
    border-radius: 8px;
}

/* Shadow Depth */
.cv-sticky-preview {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .cv-sticky-preview {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
