/* ==========================================================================
   Nelke AI Consulting - CMS Editor UI Stylesheet
   ========================================================================== */

/* Floating Control Button (only shown when logged in) */
.cms-floating-trigger {
    position: fixed !important;
    bottom: 2rem !important;
    right: 2rem !important;
    left: auto !important;
    z-index: 999999 !important;
    background: var(--gradient-primary);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 0.75rem 1.25rem;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(229, 0, 19, 0.4);
    transition: var(--transition-bounce);
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
    box-sizing: border-box;
}

.cms-floating-trigger.visible {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
}

@media (max-width: 768px) {
    .cms-floating-trigger {
        bottom: 1.5rem !important;
        right: 1.5rem !important;
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
}

/* Hide default header login button */
#loginBtn {
    display: none !important;
}



.cms-floating-trigger:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 12px 30px rgba(229, 0, 19, 0.55);
}

.cms-floating-trigger svg {
    transition: transform 0.5s ease;
}

.cms-floating-trigger:hover svg {
    transform: rotate(45deg);
}

/* Modal Overlay base */
.cms-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 14, 26, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    padding: 1.5rem;
}

.cms-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* Glassmorphic CMS Modal Card */
.cms-modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    border-radius: 20px;
    width: 100%;
    max-width: 550px;
    padding: 2.5rem;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-primary);
}

:root.dark-mode .cms-modal-card {
    background: rgba(17, 25, 43, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

.cms-overlay.open .cms-modal-card {
    transform: scale(1) translateY(0);
}

/* CMS Dashboard (Large size modal) */
.cms-modal-card.dashboard-size {
    max-width: 950px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

/* Modal Header */
.cms-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.cms-modal-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.cms-modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    border-radius: 50%;
}

.cms-modal-close-btn:hover {
    color: var(--color-purple);
    background: rgba(229, 0, 19, 0.1);
}

/* Form Styles */
.cms-form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.cms-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.cms-input, .cms-select, .cms-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

:root.dark-mode .cms-input, 
:root.dark-mode .cms-select, 
:root.dark-mode .cms-textarea {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.cms-input:focus, .cms-select:focus, .cms-textarea:focus {
    outline: none;
    border-color: var(--color-cyan);
    box-shadow: 0 0 0 3px rgba(43, 159, 159, 0.2);
}

.cms-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.cms-input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* Dashboard Navigation Tabs */
.cms-tabs-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
    padding-top: 0.25rem;
    padding-bottom: 0.75rem; /* Mehr Platz für Webkit-Scrollbars */
    margin-bottom: 1.5rem;
    scrollbar-width: none;
    flex-shrink: 0;
}

.cms-tabs-nav::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.cms-tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.1rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition-smooth);
    white-space: nowrap;
    flex-shrink: 0; /* Verhindert das Zusammenquetschen der Reiter */
}

.cms-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(124, 124, 124, 0.08);
}

.cms-tab-btn.active {
    color: #ffffff;
    background: var(--color-cyan);
    box-shadow: 0 4px 12px rgba(43, 159, 159, 0.25);
}

/* Dashboard Panels Container */
.cms-tab-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 1.5rem;
}

.cms-tab-panel {
    display: none;
}

.cms-tab-panel.active {
    display: block;
    animation: cmsFadeIn 0.3s ease-out;
}

@keyframes cmsFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Button Grid / Footer */
.cms-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
    margin-top: auto;
}

/* CMS Specific Button Colors */
.cms-btn-danger {
    background: rgba(229, 0, 19, 0.1);
    color: var(--color-purple);
    border: 1px solid rgba(229, 0, 19, 0.2);
}

.cms-btn-danger:hover {
    background: var(--color-purple);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(229, 0, 19, 0.25);
}

/* User Management Table Styles */
.cms-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
}

.cms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.cms-table th, .cms-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.cms-table th {
    background: rgba(124, 124, 124, 0.08);
    font-weight: 700;
    color: var(--text-secondary);
}

.cms-table tr:last-child td {
    border-bottom: none;
}

.cms-table tbody tr:hover {
    background: rgba(124, 124, 124, 0.04);
}

/* Badges for roles */
.cms-role-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.cms-role-badge.admin {
    background: rgba(229, 0, 19, 0.1);
    color: var(--color-purple);
    border: 1px solid rgba(229, 0, 19, 0.15);
}

.cms-role-badge.editor {
    background: rgba(43, 159, 159, 0.1);
    color: var(--color-cyan);
    border: 1px solid rgba(43, 159, 159, 0.15);
}

/* Action button icons in table */
.cms-action-btn-group {
    display: flex;
    gap: 0.35rem;
}

.cms-action-btn {
    border: 1px solid var(--border-color);
    background: #ffffff;
    cursor: pointer;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

:root.dark-mode .cms-action-btn {
    background: rgba(15, 23, 42, 0.5);
}

.cms-action-btn:hover {
    background: var(--color-cyan);
    color: #ffffff;
    border-color: transparent;
}

.cms-action-btn.delete:hover {
    background: var(--color-purple);
}

/* Alert Notification System (Toast) */
.cms-toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 90%;
    text-align: center;
}

.cms-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.cms-toast.success {
    border-left: 4px solid var(--color-cyan);
}

.cms-toast.error {
    border-left: 4px solid var(--color-purple);
}

.cms-toast-icon {
    font-size: 1.1rem;
}

.cms-toast-success-icon {
    color: var(--color-cyan);
}

.cms-toast-error-icon {
    color: var(--color-purple);
}

/* 2FA Input Verification Box */
.cms-2fa-container {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 1rem 0;
}

.cms-2fa-input-char {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

:root.dark-mode .cms-2fa-input-char {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.cms-2fa-input-char:focus {
    outline: none;
    border-color: var(--color-cyan);
    box-shadow: 0 0 0 3px rgba(43, 159, 159, 0.25);
}

/* Setup Registration Layout */
.cms-setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 500px) {
    .cms-setup-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Status Banner inside CMS */
.cms-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(43, 159, 159, 0.05);
    border: 1px solid rgba(43, 159, 159, 0.12);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.cms-user-info-badge {
    font-weight: 600;
    color: var(--color-cyan);
}

.cms-timer-badge {
    font-family: monospace;
    font-weight: 700;
    background: rgba(124, 124, 124, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

/* ==========================================================================
   WYSIWYG Editor Styles
   ========================================================================== */
.cms-wysiwyg-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

:root.dark-mode .cms-wysiwyg-container {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.cms-wysiwyg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem;
    background: rgba(124, 124, 124, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.cms-wysiwyg-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    min-width: 28px;
    height: 28px;
}

.cms-wysiwyg-btn:hover {
    background: rgba(124, 124, 124, 0.1);
    border-color: var(--border-color);
}

.cms-wysiwyg-btn.active {
    background: var(--color-cyan);
    color: #ffffff;
    border-color: transparent;
}

.cms-wysiwyg-editor {
    min-height: 120px;
    max-height: 250px;
    padding: 0.75rem 1rem;
    overflow-y: auto;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    line-height: 1.6;
    background: transparent;
}

.cms-wysiwyg-editor a {
    color: var(--color-cyan) !important;
    text-decoration: underline !important;
    font-weight: inherit !important;
}

.cms-wysiwyg-editor a:visited {
    color: var(--color-cyan) !important;
}

.cms-wysiwyg-editor a:hover {
    color: var(--color-purple) !important;
}

.cms-wysiwyg-editor a::after {
    content: "";
    display: inline-block;
    width: 0.75em;
    height: 0.75em;
    margin-left: 4px;
    vertical-align: middle;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E") no-repeat center;
    mask-size: contain;
    -webkit-mask-size: contain;
}

.cms-wysiwyg-html-view {
    min-height: 120px;
    max-height: 250px;
    padding: 0.75rem 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    resize: vertical;
    width: 100%;
}

/* WYSIWYG Select dropdowns */
.cms-wysiwyg-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: var(--font-body);
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 140px;
}

.cms-wysiwyg-select:hover {
    border-color: var(--color-cyan);
}

.cms-wysiwyg-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Globale Editor-Toolbar Stile */
#cms_global_toolbar {
    padding: 0.75rem 1rem;
    background: rgba(124, 124, 124, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1.25rem;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
}

:root.dark-mode #cms_global_toolbar {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
}

