/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 */

@tailwind base;
@tailwind components;
@tailwind utilities;

/*
 * ActionText requires trix CSS. Since we're using ActionText,
 * Rails will automatically include Trix CSS when needed.
 * No manual @import is required.
 */

/* Drag and Drop Styles */
.drag-over {
    background-color: #eff6ff !important;
    border-color: #3b82f6 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.section-item.dragging {
    opacity: 0.7;
    transform: scale(0.98);
    z-index: 1000;
}

.drag-handle {
    cursor: move !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-touch-callout: none !important;
    -khtml-user-select: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.drag-handle:hover {
    background-color: #e5e7eb !important;
    transform: scale(1.05);
}

.drag-handle:active {
    background-color: #d1d5db !important;
    transform: scale(0.98);
    cursor: grabbing !important;
}

/* Prevent text selection during drag */
.section-item.dragging,
.section-item.dragging * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-touch-callout: none !important;
    -khtml-user-select: none !important;
}

/* Make sure the drag handle is always visible and interactive */
.drag-handle svg {
    pointer-events: none !important;
}

/* Smooth transitions for all drag interactions */
.section-item {
    transition: all 0.2s ease;
}

/* Better visual feedback for drag handle */
.drag-handle {
    border: 1px solid transparent;
    border-radius: 4px;
}

.drag-handle:hover {
    border-color: #d1d5db;
}

/* Completely disable text selection on drag handle */
.drag-handle,
.drag-handle * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    pointer-events: none !important;
}

/* But make sure the drag handle itself is clickable */
.drag-handle {
    pointer-events: auto !important;
}

/* Global cursor during drag */
body.dragging {
    cursor: grabbing !important;
}

body.dragging * {
    cursor: grabbing !important;
}

/* Style Modal */
.style-option {
    transition: all 0.2s ease;
}

.style-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.style-option.border-blue-500 {
    border-color: #3b82f6 !important;
    background-color: #eff6ff !important;
}

.style-option.border-gray-200 {
    border-color: #e5e7eb;
    background-color: #ffffff;
}

/* Style Preview Cards (deprecated - keeping for backward compatibility) */
.style-preview-card {
    transition: all 0.2s ease;
    min-height: 120px;
}

.style-preview-card.selected {
    border-color: #3b82f6 !important;
    background-color: #eff6ff !important;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1);
}

.style-preview-card.not-selected {
    border-color: #d1d5db;
    background-color: #ffffff;
}

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

/* Style-specific preview content */
.standard-preview {
    font-family: 'Times New Roman', serif;
    color: #333;
    background: #ffffff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.standard-preview .font-semibold {
    color: #2c3e50;
    border-bottom: 1px solid #3498db;
    padding-bottom: 4px;
    margin-bottom: 8px;
}

.modern-preview {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #2c3e50;
    background: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
}

.modern-preview .font-semibold {
    color: #e74c3c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 14px;
    margin-bottom: 8px;
}

.classic-preview {
    font-family: 'Garamond', 'Times New Roman', serif;
    color: #2c2c2c;
    background: #f8f6f0;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #cd853f;
}

.classic-preview .font-semibold {
    color: #8b4513;
    font-variant: small-caps;
    text-decoration: underline;
    text-decoration-color: #cd853f;
    margin-bottom: 8px;
}

.minimalist-preview {
    font-family: 'Helvetica', Arial, sans-serif;
    color: #1a1a1a;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    padding: 16px;
    border-radius: 8px;
}

.minimalist-preview .font-semibold {
    color: #000;
    font-weight: 300;
    font-size: 16px;
    margin-bottom: 8px;
}

.academic-preview {
    font-family: 'Times New Roman', serif;
    color: #2c2c2c;
    background: #fafafa;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #34495e;
}

.academic-preview .font-semibold {
    color: #2c3e50;
    font-weight: bold;
    margin-bottom: 8px;
}

/* Modal backdrop blur effect */
.modal-backdrop {
    backdrop-filter: blur(4px);
}

/* Ensure modal content is scrollable */
.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}