/* CRM Project Section Styles - Elegant React-inspired Design */

.crm-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 2rem;
    margin-left: 16rem; /* Account for sidebar */
}

/* Header Styles */
.crm-header {
    border: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.crm-header h1 {
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Language Selector */
.language-selector {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.language-selector:hover {
    border-color: var(--forest-300);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Action Buttons */
.btn-action {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

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

/* Main Tabs */
.main-tabs {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.main-tabs .k-tabstrip-items {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid #e2e8f0;
    padding: 0 1rem;
}

.main-tabs .k-tabstrip-item {
    border: none;
    margin: 0 0.25rem;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
}

.main-tabs .k-tabstrip-item:hover {
    background: rgba(34, 197, 94, 0.05);
}

.main-tabs .k-tabstrip-item.k-active {
    background: white;
    border-bottom: 3px solid var(--forest-500);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.main-tabs .k-link {
    font-weight: 500;
    color: #64748b;
    padding: 1rem 1.5rem;
}

.main-tabs .k-active .k-link {
    color: var(--forest-600);
}

/* Tab Content */
.tab-content-padding {
    padding: 2rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-label.required::after {
    content: " *";
    color: #ef4444;
}

.form-input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--forest-500);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.form-help {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* Content Editor */
.content-editor {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    /* Fix overflow containment while maintaining editor structure */
    position: relative;
    max-height: 700px;
    display: flex;
    flex-direction: column;
}

/* Ensure FontAwesome is loaded in editor iframe */
.content-editor iframe {
    font-family: inherit;
}

.content-editor .k-editor-content {
    font-family: inherit;
}

/* Telerik Editor Structure Fix */
.content-editor .k-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 650px;
    overflow: hidden;
}

.content-editor .k-editor-toolbar {
    /* Ensure toolbar stays visible and accessible */
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
    padding: 0.75rem;
}

.content-editor .k-editor-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Important for flex child to shrink */
}

/* FontAwesome icons in editor */
.content-editor .fas, .content-editor .far, .content-editor .fab {
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands';
    font-weight: 900;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.content-editor .k-editor-content {
    flex: 1;
    min-height: 400px;
    padding: 1.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    font-size: 16px;
    color: #374151;
    /* Proper scroll handling for content */
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    box-sizing: border-box;
    /* Ensure full content accessibility */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

/* Webkit scrollbar styling for better UX */
.content-editor .k-editor-content::-webkit-scrollbar {
    width: 8px;
}

.content-editor .k-editor-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.content-editor .k-editor-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.content-editor .k-editor-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* HomePage Content Styles for Editor */
.content-editor .k-editor-content p {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1.125rem;
    line-height: 1.75;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.content-editor .k-editor-content .text-lg {
    font-size: 1.125rem;
    line-height: 1.75;
}

.content-editor .k-editor-content .text-tuff-600 {
    color: #8b5e3c;
}

.content-editor .k-editor-content .leading-relaxed {
    line-height: 1.625;
}

.content-editor .k-editor-content .space-y-4 > * + * {
    margin-top: 1rem;
}

.content-editor .k-editor-content .flex {
    display: flex;
}

.content-editor .k-editor-content .items-start {
    align-items: flex-start;
}

.content-editor .k-editor-content .flex-shrink-0 {
    flex-shrink: 0;
}

.content-editor .k-editor-content .ml-4 {
    margin-left: 1rem;
}

.content-editor .k-editor-content .font-roboto-condensed {
    font-family: 'Roboto Condensed', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.content-editor .k-editor-content .font-bold {
    font-weight: 700;
}

.content-editor .k-editor-content .text-lg {
    font-size: 1.125rem;
}

.content-editor .k-editor-content .text-tuff-700 {
    color: #713f12;
}

.content-editor .k-editor-content .text-forest-500 {
    color: var(--forest-500);
}

.content-editor .k-editor-content .text-xl {
    font-size: 1.25rem;
}

.content-editor .k-editor-content .mt-1 {
    margin-top: 0.25rem;
}

.content-editor .k-editor-content .fas {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

/* Upload Area Styles */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.upload-area:hover {
    border-color: var(--forest-300);
    background: var(--forest-50);
}

/* Preview Content Styles */
.preview-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--forest-50);
    border-radius: 8px;
}

.preview-content .project-content p {
    font-size: 1.125rem;
    line-height: 1.75;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.preview-content .space-y-4 > * + * {
    margin-top: 1rem;
}

.preview-content .flex {
    display: flex;
}

.preview-content .items-start {
    align-items: flex-start;
}

.preview-content .flex-shrink-0 {
    flex-shrink: 0;
}

.preview-content .ml-4 {
    margin-left: 1rem;
}

.preview-content h3 {
    font-family: 'Roboto Condensed', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
    font-size: 1.125rem;
    color: #713f12;
    margin-bottom: 0.5rem;
}

.preview-content .fas {
    color: var(--forest-500);
    font-size: 1.25rem;
    margin-top: 0.25rem;
}

/* Image Management */
.image-preview-container {
    position: relative;
    display: inline-block;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.image-preview {
    max-width: 400px;
    max-height: 300px;
    object-fit: cover;
    display: block;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-preview-container:hover .image-overlay {
    opacity: 1;
}

.overlay-btn {
    background: rgba(239, 68, 68, 0.9) !important;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 500;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.upload-placeholder:hover {
    border-color: var(--forest-300);
    background: var(--forest-50);
}

.upload-controls {
    space-y: 1rem;
}

.file-select {
    margin-bottom: 1rem;
}

/* Settings Styles */
.settings-section {
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    margin-bottom: 1.5rem;
}

.settings-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.checkbox-label {
    margin-left: 0.75rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
}

.metadata-info {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
}

.metadata-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.metadata-item:last-child {
    border-bottom: none;
}

.metadata-label {
    font-weight: 500;
    color: #6b7280;
}

.metadata-value {
    font-weight: 500;
    color: #374151;
}

/* Danger Zone */
.danger-zone {
    border-color: #fecaca;
    background: linear-gradient(135deg, #fef2f2 0%, #fef7f7 100%);
}

.danger-zone .settings-title {
    color: #dc2626;
    border-bottom-color: #fecaca;
}

.danger-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.danger-btn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    border: none;
    color: white;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.danger-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3);
}

/* Notification Styles */
.app-notification {
    z-index: 10000;
}

.app-notification .k-notification {
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: none;
    backdrop-filter: blur(8px);
}

/* Loading State */
.k-loader-container {
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(4px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .crm-page {
        margin-left: 0;
        padding: 1rem;
    }
    
    .crm-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .tab-content-padding {
        padding: 1rem;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Icon Picker Modal */
.icon-picker-content {
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

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

.form-group {
    animation: slideIn 0.3s ease-out;
}

/* Specific containment for editor form groups */
.form-group:has(.content-editor) {
    position: relative;
    /* Remove overflow hidden to allow proper editor functionality */
}

/* Additional safety for editor container */
.content-editor .k-editor-content iframe {
    /* Ensure iframe content respects boundaries */
    max-width: 100%;
    box-sizing: border-box;
}

/* Fix for any potential z-index issues */
.content-editor .k-editor-toolbar .k-toolbar {
    position: relative;
    z-index: 5;
}

/* Grid utilities */
.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gap-6 {
    gap: 1.5rem;
}

.space-y-6 > * + * {
    margin-top: 1.5rem;
}

/* Media queries for grid */
@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}