/* ==================================================================
   RICH TEXT EDITOR - MEDIA UPLOAD MODALS
   ================================================================== */
.media-upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-layer-modal);
}

.media-upload-modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-3);
}

.media-upload-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.media-upload-modal-header h3 {
    margin: 0;
    font-size: var(--font-size-16);
    color: var(--text-primary);
}

.media-upload-modal-body {
    padding: var(--space-5);
}

.modal-hint {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.upload-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.upload-tab {
    flex: 1;
    padding: var(--space-1-5) var(--space-3);
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--font-size-14);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-in-out);
}

.upload-tab:hover {
    background: var(--bg-hover);
}

.upload-tab:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
}

.upload-tab.active {
    background: var(--accent-fill);
    color: white;
    border-color: var(--accent-fill);
}

.upload-tab-content {
    display: none;
}

.upload-tab-content.active {
    display: block;
}

.upload-dropzone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-10) var(--space-5);
    text-align: center;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-in-out);
}

.upload-dropzone:hover {
    border-color: var(--accent-blue);
    background: rgba(var(--accent-blue-rgb, 59, 130, 246), 0.05);
}

.upload-dropzone svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-tertiary);
    fill: none;
    stroke-width: 2;
    margin: 0 auto 12px;
}

.upload-dropzone p {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-size-14);
}

.url-input {
    width: 100%;
    padding: var(--space-2-5) var(--space-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-14);
    color: var(--text-primary);
    background: var(--bg-primary);
    margin-bottom: 12px;
}

.url-input:focus {
    outline: none;
    outline-offset: 2px;
    border-color: var(--accent-blue);
}

/* Duplicate .btn-primary definition removed - consolidated definition exists at line 9855 */

/* ==================================================================
   RICH TEXT EDITOR - PICKER MODALS
   ================================================================== */
.picker-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-3);
    z-index: var(--z-layer-modal);
    width: 90%;
    max-width: 400px;
    max-height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.picker-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.picker-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.picker-modal-header h3 {
    margin: 0 0 12px 0;
    font-size: var(--font-size-16);
    color: var(--text-primary);
}

.picker-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: var(--font-size-14);
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.picker-search:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.picker-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.picker-item {
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: var(--font-size-14);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-in-out);
}

.picker-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
}

.picker-item:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
}

/* Template Pickers */
.template-picker {
    max-width: 600px;
    max-height: 70vh;
}

.template-picker .picker-modal-body {
    max-height: calc(70vh - 120px); /* Account for header and padding */
    overflow-y: auto;
}

.template-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.template-item,
.table-template-item {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-in-out);
    display: flex;
    align-items: center;
    gap: 16px;
}

.template-item:hover,
.table-template-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
}

.template-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.template-icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--text-secondary);
}

.template-name {
    font-weight: 600;
    font-size: var(--font-size-14);
    color: var(--text-primary);
    margin-bottom: 4px;
}

.template-desc {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.template-item:hover .template-icon svg,
.table-template-item:hover .template-icon svg {
    stroke: var(--accent-blue);
}

/* Emoji Picker */
.emoji-categories {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
}

.emoji-category {
    background: transparent;
    border: none;
    font-size: var(--font-size-lg);
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-in-out);
    opacity: 0.5;
}

.emoji-category:hover {
    background: var(--bg-hover);
    opacity: 1;
}

.emoji-category.active {
    background: var(--bg-secondary);
    opacity: 1;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 4px;
}

.emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-in-out);
}

.emoji-item:hover {
    background: var(--bg-hover);
    transform: scale(1.2);
}

/* Template Picker */
.template-grid {
    display: grid;
    gap: 12px;
}

.template-item,
.table-template-item {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-in-out);
}

.template-item:hover,
.table-template-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
}

.template-icon {
    font-size: var(--font-size-2xl);
    margin-bottom: 8px;
}

.template-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: var(--font-size-14);
}

.template-desc {
    font-size: var(--font-size-12);
    color: var(--text-tertiary);
}
