* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Editor styling */
#editor {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    line-height: 1.7;
    resize: none;
    outline: none;
    width: 100%;
    height: 100%;
    border: none;
    background: #fafafa;
    color: #18181b;
    padding: 24px;
    caret-color: #f97316;
    min-height: 0;
}

#editor:focus {
    outline: none;
}

#editor::placeholder {
    color: #a1a1aa;
}

/* Preview container */
.preview-wrapper {
    overflow: auto;
    display: flex;
    justify-content: center;
    padding: 32px;
    background: #fafafa;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}

.preview-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.preview-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.preview-wrapper::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 4px;
}

.preview-wrapper::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    border: 3px solid #e5e7eb;
    border-top: 3px solid #f97316;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

/* Button styling */
.btn-action {
    background: white;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.btn-action:hover {
    background: #fafafa;
    border-color: #d4d4d8;
    color: #18181b;
}

.btn-action svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: #f97316;
    border-color: #f97316;
    color: white;
}

.btn-primary:hover {
    background: #ea580c;
    border-color: #ea580c;
}

.btn-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #ef4444;
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Language switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 1px;
    background: #e5e7eb;
    border-radius: 8px;
    padding: 2px;
}

.lang-option {
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    color: #6b7280;
    font-weight: 500;
}

.lang-option.active {
    background: white;
    color: #f97316;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.lang-option:not(.active):hover {
    background: #f3f4f6;
    color: #374151;
}

/* Panel headers */
.panel-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    color: #18181b;
}

/* Action buttons container */
.actions-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Main header */
.main-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.brand-logo {
    width: 28px;
    height: 28px;
}

.brand-logo svg {
    width: 100%;
    height: 100%;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: #18181b;
    letter-spacing: -0.01em;
}

/* Mobile Menu Button */
#mobile-menu-btn {
    display: none;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-titles {
    flex: 1;
}

.header-divider {
    width: 1px;
    height: 32px;
    background: #e5e7eb;
    border-radius: 1px;
}

.header-actions {
    display: flex;
    align-items: center;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: #18181b;
    letter-spacing: -0.01em;
}

.header-subtitle {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

/* Mobile Menu Button */
#mobile-menu-btn {
    display: none;
}

@media screen and (max-width: 768px) {
    #mobile-menu-btn {
        display: flex;
    }
    
    .header-brand, .header-titles, .header-actions {
        flex: 1;
    }
    
    .header-divider {
        display: none;
    }
}

/* Branding */
.brand-logo {
    width: 28px;
    height: 28px;
}

.brand-logo svg {
    width: 100%;
    height: 100%;
}

/* Preview header-secondary */
.preview-header-secondary {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.header-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content > div:first-child {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-content > div:first-child > div {
    min-width: 0;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: #18181b;
    letter-spacing: -0.01em;
}

.header-subtitle {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 1px;
}

/* Hidden file input */
#file-input {
    display: none;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 56px;
}

.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar.collapsed .sidebar-toggle-icon {
    transform: rotate(180deg);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
}

.sidebar-title {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex: 1;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.sidebar-toggle:hover {
    background: #f3f4f6;
    color: #374151;
}

.sidebar-toggle svg {
    transition: transform 0.2s ease;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.cv-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cv-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    gap: 8px;
}

.cv-item:hover {
    background: #f3f4f6;
}

.cv-item.active {
    background: #fff7ed;
    border-color: #f97316;
    box-shadow: 0 1px 3px rgba(249, 115, 22, 0.1);
}

.cv-item.active .cv-name {
    color: #f97316;
    font-weight: 600;
}

.cv-item.active .cv-last-modified {
    color: #f97316;
}

.cv-item.active .cv-checkbox {
    border-color: #f97316;
    background: #fff7ed;
}

.cv-item-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.cv-item-main {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.cv-name {
    font-size: 14px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cv-last-modified {
    font-size: 11px;
    color: #9ca3af;
    margin-left: 32px;
    margin-top: 2px;
    font-weight: 400;
}

@media screen and (max-width: 768px) {
    .cv-last-modified {
        font-size: 9px;
    }
}

@media screen and (max-width: 480px) {
    .cv-last-modified {
        font-size: 8px;
    }
}

.cv-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.cv-item:hover .cv-actions {
    opacity: 1;
}

.cv-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.cv-action-btn:hover {
    background: white;
    color: #374151;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cv-action-btn.delete:hover {
    background: #fef2f2;
    color: #ef4444;
}

.new-cv-btn {
    margin-top: 8px;
    padding: 12px;
    border: 1px dashed #d1d5db;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.new-cv-btn:hover {
    border-color: #9ca3af;
    background: #fafafa;
    color: #374151;
}

.new-cv-btn svg {
    width: 16px;
    height: 16px;
}

/* Collapsed sidebar icon */
.sidebar-collapsed-content {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    gap: 8px;
}

.sidebar.collapsed .sidebar-collapsed-content {
    display: flex;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

/* Empty state */
.empty-state {
    display: none;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    overflow: auto;
}

.empty-state.show {
    display: flex;
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    margin-bottom: 24px;
    color: #d1d5db;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: #18181b;
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
    max-width: 320px;
    line-height: 1.6;
}

/* Rename modal */
.rename-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.rename-modal.show {
    display: flex;
}

.rename-modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    width: 340px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.rename-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #18181b;
    margin-bottom: 16px;
}

.rename-modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #18181b;
    outline: none;
    margin-bottom: 16px;
}

.rename-modal-input:focus {
    border-color: #f97316;
}

.rename-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.rename-modal-actions .btn-action {
    padding: 8px 16px;
}

/* Character Counter */
.char-counter {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    gap: 2px;
    white-space: nowrap;
}

.char-separator {
    color: #d1d5db;
    margin: 0 2px;
}

.char-counter.limit-exceeded {
    background: #fef2f2;
    color: #dc2626;
}

.char-counter.limit-exceeded .char-current {
    color: #dc2626;
    font-weight: 600;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 8px;
}

.zoom-level {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    min-width: 42px;
    text-align: center;
}

.zoom-level.changed {
    color: #f97316;
}

.btn-action.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary.disabled {
    background: #fdba74;
    border-color: #fdba74;
}

/* Checkbox styles - always visible */
.cv-checkbox {
    display: flex;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 12px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.cv-checkbox:hover {
    border-color: #9ca3af;
}

.cv-checkbox.checked {
    background: #f97316;
    border-color: #f97316;
    transform: scale(1.05);
}

.cv-checkbox svg {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    stroke-width: 2.5;
}

.cv-checkbox.checked svg {
    opacity: 1;
    transform: scale(1);
}

.cv-item.selected {
    background: #fff7ed;
    border-color: #fdba74;
}

.cv-item.selected .cv-name {
    color: #f97316;
    font-weight: 600;
}

/* Selection action bar (fixed at bottom) */
.selection-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.12);
    display: none;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.selection-action-bar.show {
    display: flex;
}

.action-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    gap: 20px;
}

.action-bar-counter {
    flex: 1;
    padding: 8px 0;
}

.selection-counter {
    font-size: 15px;
    font-weight: 600;
    color: #f97316;
    white-space: nowrap;
}

.action-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-bar-actions .btn-action {
    height: 44px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 0;
}

.action-bar-actions .btn-action svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.action-bar-actions .btn-action span {
    white-space: nowrap;
}

.action-bar-actions .btn-primary {
    padding: 0 24px;
    font-weight: 600;
}

/* Select All button on desktop */
.select-all-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
}

.select-all-btn svg {
    width: 16px;
    height: 16px;
}

.select-all-btn span {
    font-size: 13px;
}

.selection-action-bar.show {
    display: flex;
}

.action-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    gap: 16px;
}

.selection-counter-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.selection-counter {
    font-size: 15px;
    font-weight: 600;
    color: #f97316;
    white-space: nowrap;
}

.action-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-bar-actions .btn-action {
    height: 40px;
    padding: 0 20px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    flex-shrink: 0;
}

.action-bar-actions .btn-action svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.action-bar-actions .btn-action span {
    white-space: nowrap;
}

.action-bar-actions .btn-primary {
    padding: 0 24px;
    font-weight: 600;
}

/* Select All button on desktop */
.select-all-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
}

.select-all-btn svg {
    width: 16px;
    height: 16px;
}

.select-all-btn span {
    font-size: 13px;
}

/* Progress overlay */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.progress-overlay.show {
    display: flex;
}

.progress-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    width: 400px;
    text-align: center;
}

.progress-spinner {
    border: 4px solid #e5e7eb;
    border-top: 4px solid #f97316;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

.progress-title {
    font-size: 18px;
    font-weight: 600;
    color: #18181b;
    margin-bottom: 8px;
}

.progress-status {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 24px;
}

.progress-bar {
    height: 100%;
    background: #f97316;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-cancel {
    padding: 10px 20px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    transition: all 0.15s ease;
}

.progress-cancel:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Batch delete modal */
.batch-delete-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.batch-delete-modal.show {
    display: flex;
}

.batch-delete-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    width: 420px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.batch-delete-title {
    font-size: 16px;
    font-weight: 600;
    color: #18181b;
    margin-bottom: 8px;
}

.batch-delete-count {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

.batch-delete-list {
    max-height: 200px;
    overflow-y: auto;
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
}

.batch-delete-item {
    padding: 10px 12px;
    font-size: 13px;
    color: #374151;
    border-radius: 6px;
}

.batch-delete-item:hover {
    background: #f3f4f6;
}

.batch-delete-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Sidebar icon button */
.sidebar-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    background: white;
    color: #374151;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sidebar-icon-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.sidebar-icon-btn svg {
    width: 16px;
    height: 16px;
}

/* Main content wrapper */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Editor and preview panels */
#editor-preview-wrapper {
    gap: 0;
}

#editor-preview-wrapper > div:first-child {
    background: white;
}

#editor-preview-wrapper > div:last-child {
    background: #fafafa;
}
