/* css/cms.css */

/* CMS View Layout */
#view-cms {
    display: flex;
    height: 100%;
    background: #f4f6f8;
    overflow: hidden;
}

.cms-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.cms-sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #e2e8f0;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.cms-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding: 20px;
}

#cms-main-privacy,
#cms-main-terms,
#cms-main-about,
#cms-main-contact,
#cms-main-index {
    overflow-y: auto;
    display: block;
    min-height: 0;
    /* Critical for flex items to scroll */
    flex-basis: 0;
    /* Ensure it grows from 0 */
}

/* Sidebar Items */
/* [STANDARDIZED] Styles moved to pos_global.css (.cheesy-sidebar-item)
.cms-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 10px;
    color: #4a5568;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.cms-menu-item:hover {
    background: #edf2f7;
    color: #2d3748;
}

.cms-menu-item.active {
    background: #5e1c26;
    color: white;
    box-shadow: 0 4px 6px rgba(94, 28, 38, 0.2);
}
*/

/* Forms and Inputs */
input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='url'],
input[type='search'],
textarea,
.form-control:not(select),
[contenteditable='true'],
.editor-content {
    cursor: text;
}

select.form-control,
.filter-btn {
    cursor: pointer;
}

.cms-menu-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #a0aec0;
    font-weight: 800;
    margin: 20px 0 10px 10px;
    letter-spacing: 1px;
}

/* Article Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding-bottom: 40px;
    overflow-y: auto;
}

.article-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    transition:
        transform 0.2s,
        box-shadow 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
}

.article-thumb {
    height: 160px;
    width: 100%;
    object-fit: cover;
    background: #f7fafc;
}

.article-body {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    backdrop-filter: blur(4px);
}

.status-draft {
    background: #f6e05e;
    color: #744210;
}

.status-published {
    background: #48bb78;
    color: white;
}

.article-title {
    font-weight: 700;
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 8px;
    line-height: 1.4;
    height: 44.8px;
    /* Exactly 2 lines (16px * 1.4 * 2) */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    font-size: 12px;
    color: #718096;
    margin-bottom: 15px;
    height: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.article-meta i {
    font-size: 13px;
    color: #a0aec0;
}

.meta-sep {
    color: #e2e8f0;
    font-weight: 300;
}

.article-actions {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Modal Editor */
.editor-container {
    margin-top: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.editor-toolbar {
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.editor-btn {
    background: white;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #4a5568;
    transition: 0.2s;
}

.editor-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.editor-btn.active {
    background: #cbd5e0;
    color: #1a202c;
}

.editor-content {
    min-height: 300px;
    height: 100%;
    /* Fill container */
    overflow-y: auto;
    padding: 20px;
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    color: #2d3748;
    outline: none;
    text-align: justify;
}

.editor-content b {
    font-weight: 700;
}

.editor-content i {
    font-style: italic;
}

.editor-content u {
    text-decoration: underline;
}

.editor-content s {
    text-decoration: line-through;
}

/* References Section in Modal */
/* References List - Pure Flat */
.references-list {
    margin-top: 20px;
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
    background: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

#referencesContainer {
    background: none !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

/* Renamed to break any cache on container styles */
/* Renamed again and aggressive reset */
.ref-item-flat-text {
    display: grid;
    /* Grid is mathematically safer for 'fill remaining space' */
    grid-template-columns: 1fr auto;
    align-items: center;
    /* width: 100%; REMOVED to fix horizontal scroll */
    box-sizing: border-box;
    /* Ensure padding doesn't add to width */
    gap: 20px;
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 20px;
    padding: 15px 20px 15px 15px;
    /* Added right padding so buttons don't hit edge */
    border-left: 4px solid #cbd5e0;

    /* Aggressive Reset */
    background: transparent !important;
    box-shadow: none !important;
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-radius: 0 !important;
}

.ref-item-flat-text * {
    background: transparent !important;
    box-shadow: none !important;
    box-sizing: border-box;
}

.ref-item-flat-text:hover {
    border-left-color: #5e1c26;
}

/* Specific forceful animation */
.modal-entry-anim {
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
    opacity: 0;
    /* Start hidden for animation */
}

@keyframes modalPop {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ref-content {
    min-width: 0;
    /* Essential for Grid text wrapping */
    flex: 1;
    /* Simple flex grow */
    line-height: 1.6;
    word-break: break-word;
    /* padding-right handled by gap */
    white-space: normal;
}

.ref-content i {
    font-style: italic;
    color: #2d3748;
}

.ref-content a {
    color: #5e1c26;
    text-decoration: underline;
}

.ref-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    /* margin-left removed to avoid conflict */
    opacity: 1;
    align-items: center;
}

.ref-edit,
.ref-delete {
    border: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.5) !important;
    color: #718096;
    cursor: pointer;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 6px !important;
    transition: all 0.2s;
}

.ref-edit:hover {
    color: #5e1c26;
    border-color: #5e1c26;
    background: white !important;
}

.ref-delete:hover {
    color: #c0392b;
    border-color: #c0392b;
    background: white !important;
}

/* Reference Linker Submodal */
.submodal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.submodal-content {
    background: white;
    padding: 0;
    border-radius: 12px;
    width: 450px;
    max-width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Scroll Isolation for Editor Modal */
#modalArticleEditor .modal-content {
    overscroll-behavior: contain;
}

/* Public Blog Styles (for article.html & blog.html integration) */
/* (Ideally these go in css/index.css or a new css/blog.css, keeping here for now or imported) */

/* ================================
   ENHANCED EDITOR TOOLBAR STYLES
   ================================ */
.editor-select {
    height: 32px;
    padding: 0 8px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    background: white;
    font-size: 12px;
    color: #4a5568;
    cursor: pointer;
}

.editor-select:hover {
    background: #e2e8f0;
}

.editor-separator {
    width: 1px;
    height: 24px;
    background: #cbd5e0;
    margin: 4px 6px;
}

/* Color Swatches */
.editor-colors {
    display: flex;
    gap: 4px;
    align-items: center;
}

.editor-color-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition:
        transform 0.15s,
        box-shadow 0.15s;
}

.editor-color-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ================================
   CUSTOM NODES - CALLOUTS
   ================================ */
.callout {
    position: relative;
    padding: 20px 20px 20px 60px;
    margin: 40px 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.callout-delete,
.quote-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    color: #666;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.callout-delete:hover,
.quote-delete:hover {
    background: #d32f2f;
    color: white;
}

/* Hook Shared for Callouts */
.callout::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 15px;
    bottom: 0;
    width: 25px;
    border-left: 5px solid #ccc;
    border-bottom: 5px solid #ccc;
    border-bottom-left-radius: 20px;
    z-index: 1;
}

/* Icon Shared for Callouts */
.callout::after {
    position: absolute;
    top: -30px;
    left: -13px;
    font-size: 80px;
    line-height: 1;
    font-family: 'Times New Roman', serif;
    background: #fff;
    padding-bottom: 10px;
    height: 60px;
    width: 60px;
    text-align: center;
    z-index: 2;
}

.callout-info::before {
    border-color: #4299e1;
}

.callout-info::after {
    content: '';
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234299e1'%3E%3Cpath d='M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    width: 60px;
    height: 60px;
    top: -30px;
    left: -12px;
}

.callout-warning::before {
    border-color: #ed8936;
}

.callout-warning::after {
    content: '';
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ed8936'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath fill='%23fff' d='M11 15h2v2h-2zm0-8h2v6h-2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    width: 60px;
    height: 60px;
    top: -30px;
    left: -13px;
}

.callout-tip::before {
    border-color: #dbac00;
}

.callout-tip::after {
    content: '';
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23dbac00'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6A4.997 4.997 0 0 1 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1zM9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    width: 60px;
    height: 60px;
    top: -30px;
    left: -13px;
}

.callout-content {
    flex: 1;
    font-size: 15px;
    line-height: 1.8;
    color: #2d3748;
}

.callout-content:focus {
    outline: none;
}

/* ================================
   CUSTOM NODES - QUOTES
   ================================ */
.custom-quote {
    position: relative;
    padding: 20px 20px 20px 60px;
    margin: 50px 0;
    background: transparent;
    border: none;
}

/* ================================
   RESPONSIVE LAYOUT (Mobile Sidebar)
   ================================ */

/* Similar logic to Finances/Team sidebar for consistency */
@media (max-width: 1024px) {
    .cms-sidebar {
        width: 65px;
        /* Compact width */
        padding: 20px 5px;
        /* Reduced vertical padding */
        align-items: center;
        /* Center items */
    }

    /* Hide header details */
    .cms-sidebar>div:first-child h3,
    .cms-sidebar>div:first-child p {
        display: none;
    }

    .cms-sidebar>div:first-child {
        border-bottom: none;
        margin-bottom: 5px;
        padding-bottom: 10px;
    }

    /* Add a small logo or icon if needed for header, or just keep it empty */

    .cms-menu-item {
        justify-content: center;
        padding: 12px 0;
        /* Center content vertically */
        width: 45px;
        /* Circular target */
        height: 45px;
        border-radius: 12px;
        margin: 0 auto 10px auto;
        /* Center in sidebar */
    }

    .cms-menu-item span {
        display: none;
        /* Hide Label */
    }

    .cms-menu-item i {
        margin: 0;
        font-size: 20px;
        /* Larger icons */
    }

    /* Adjust main content padding */
    .cms-main {
        padding: 10px;
    }

    /* Adjust Grid for smaller screens - REMOVED TO ALLOW CUSTOM MOBILE GRID */
    /* .articles-grid { grid-template-columns: repeat(auto-fill, minmax(100%, 1fr)); gap: 15px; } */

    /* Adjust Table Editor for mobile if needed */
    .editor-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* The Hook Line */
.custom-quote::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 15px;
    bottom: 0;
    width: 25px;
    border-left: 5px solid #1a365d;
    border-bottom: 5px solid #1a365d;
    border-bottom-left-radius: 20px;
    z-index: 1;
}

/* The Quote Icon */
.custom-quote::after {
    content: '“';
    position: absolute;
    top: -30px;
    /* Standardised Top */
    left: -13px;
    font-size: 100px;
    line-height: 1;
    color: #1a365d;
    font-family: Georgia, serif;
    background: #fff;
    padding-bottom: 10px;
    height: 60px;
    width: 60px;
    text-align: center;
    z-index: 2;
}

/* Quote Author Styling (Second Line) */
.custom-quote p:nth-of-type(2),
.custom-quote-content:nth-of-type(2) {
    display: block;
    margin-top: 15px;
    font-weight: 700;
    font-size: 1.15rem;
    color: #1a365d;
}

.custom-quote p,
.custom-quote-content {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #4a5568;
    margin: 0;
}

.custom-quote-content:focus {
    outline: none;
}

/* ================================
   EDITOR CONTENT - HEADERS
   ================================ */
.editor-content h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #5e1c26;
    margin: 25px 0 15px 0;
    line-height: 1.3;
}

.editor-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2d3748;
    margin: 20px 0 10px 0;
    line-height: 1.4;
}

.editor-content ul,
.editor-content ol {
    margin: 10px 0;
    padding-left: 25px;
}

.editor-content ul {
    list-style: none;
}

.editor-content ul li {
    position: relative;
}

.editor-content ul li::before {
    content: '—';
    position: absolute;
    left: -20px;
    color: #5e1c26;
    font-weight: 600;
}

.editor-content li {
    margin-bottom: 5px;
}

.editor-content a {
    color: #3498db;
    text-decoration: underline;
}

/* ================================
   CMS TABLE EDITOR STYLES
   ================================ */
.cms-table {
    width: 100%;
    margin: 20px 0;
    border-collapse: separate;
    /* Required for border-radius */
    border-spacing: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    /* Rounded Corners */
    overflow: hidden;
    table-layout: fixed;
    /* Respect custom widths */
}

.cms-table th,
.cms-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
    position: relative;
    word-break: break-word;
}

.cms-table th {
    background-color: #f7fafc;
    font-weight: 600;
    color: #2d3748;
}

/* Remove outer borders for cleaner look */
.cms-table tr:last-child td {
    border-bottom: none;
}

.cms-table tr th:last-child,
.cms-table tr td:last-child {
    border-right: none;
}

/* UI Controls (In Overlay) */
.cms-table-add-btn {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: #4299e1;
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    z-index: 1005;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s;
    user-select: none;
}

.cms-table-add-btn:hover {
    transform: scale(1.2);
    background-color: #3182ce;
}

.cms-table-resizer {
    background: transparent;
    /* Invisible by default */
}

.cms-table-resizer:hover {
    background: rgba(66, 153, 225, 0.5);
    /* Blue hint */
}

/* Table Selection Styles */
.selected-row td {
    background-color: rgba(66, 153, 225, 0.15) !important;
    outline: 2px solid #4299e1;
    z-index: 1;
}

.selected-col {
    background-color: rgba(66, 153, 225, 0.15) !important;
    outline: 2px solid #4299e1;
    z-index: 1;
}

.cms-table-select-handle {
    background-color: transparent;
    transition: background-color 0.2s;
}

.cms-table-select-handle:hover {
    background-color: rgba(66, 153, 225, 0.3);
    cursor: pointer;
}

.select-col:hover::after {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #4299e1;
}

.select-row:hover::after {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #4299e1;
}

/* Row Resizer Styles */
.resizer-row:hover {
    background: rgba(66, 153, 225, 0.5);
}

/* Table Grid Selector */
.table-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 4px;
    width: 250px;
    height: 250px;
}

.table-grid-cell {
    width: 24px;
    height: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}

.table-grid-cell.active {
    background-color: #4299e1;
    border-color: #3182ce;
    box-shadow: 0 0 5px rgba(66, 153, 225, 0.5);
}

/* Media Editor & Cropper Styles */
.media-tabs {
    border-bottom: 2px solid #f7fafc;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #718096;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #4299e1;
    border-bottom: 2px solid #4299e1;
}

.upload-dropzone {
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
}

.upload-dropzone:hover {
    border-color: #4299e1;
    background: #ebf8ff;
}

.upload-dropzone p {
    font-size: 13px;
    color: #4a5568;
    margin-top: 10px;
}

/* Cropper Interface */
.cropper-container {
    width: 100%;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    padding: 20px;
    /* Padding to see borders of large images */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.cropper-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#cropperImg {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
}

.cropper-focal-target {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(0, 0, 0, 0.5);
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 10;
}

.focal-crosshair {
    width: 20px;
    height: 20px;
    position: relative;
}

.focal-crosshair::before,
.focal-crosshair::after {
    content: '';
    position: absolute;
    background: #fff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.focal-crosshair::before {
    width: 2px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.focal-crosshair::after {
    width: 100%;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
}

/* Article Image Styles (Editor) */
.cms-article-img-container {
    position: relative;
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
}

.cms-article-img-container img {
    width: 100%;
    display: block;
    border-radius: 12px;
}

/* Improved Cropper UI */
.cropper-grid {
    position: absolute;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    /* Dim everything outside */
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: move;
    pointer-events: auto;
    background: transparent;
    aspect-ratio: 16 / 9;
}

.cropper-grid::before,
.cropper-grid::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
}

.cropper-grid::before {
    left: 33.33%;
    right: 33.33%;
    top: 0;
    bottom: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.cropper-grid::after {
    top: 33.33%;
    bottom: 33.33%;
    left: 0;
    right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.cropper-marker {
    display: none;
    /* Hide old marker if using movable grid */
}

/* Cropper Resize Handles */
.cropper-resizer {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 1px solid #4299e1;
    z-index: 10;
}

.resizer-tl {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.resizer-tr {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.resizer-bl {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.resizer-br {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

/* Ultra-precise Cropper UI */
.cropper-grid {
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.7);
    /* Much darker outside */
    border: 1px solid #fff;
    outline: 1px solid rgba(0, 0, 0, 0.5);
}

.cropper-grid::before,
.cropper-grid::after {
    background: rgba(255, 255, 255, 0.5) !important;
    /* Brighter lines */
}

/* More visible resizer handles */
.cropper-resizer {
    width: 16px;
    height: 16px;
    background: #4299e1;
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Image Deletion & Caption UI */
.cms-article-img-container .btn-delete-element {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #e53e3e;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
}

.cms-article-img-container:hover .btn-delete-element {
    opacity: 1;
}

.cms-img-caption {
    font-size: 13px;
    color: #718096;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
    line-height: 1.4;
}

/* Enhanced Delete Buttons for CMS */
.cms-article-img-container .btn-delete-element,
.cms-video-container .btn-delete-element,
.callout-delete,
.quote-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100 !important;
    font-size: 14px;
    opacity: 0.8;
    transition: all 0.2s;
    line-height: 1;
    pointer-events: auto !important;
}

.cms-article-img-container .btn-delete-element:hover,
.cms-video-container .btn-delete-element:hover,
.callout-delete:hover,
.quote-delete:hover {
    opacity: 1;
    transform: scale(1.1);
    background: #c53030;
}

/* Ensure parents allow clicking children */
.cms-article-img-container,
.cms-video-container,
.callout-container,
.quote-container {
    pointer-events: auto !important;
}

/* --- Modernized Article Card Actions --- */
.article-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #edf2f7;
}

.article-actions .btn-action-sm {
    flex: 1;
    height: 40px;
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-edit {
    background: #4299e1;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.2) !important;
}

.btn-view {
    background: var(--vino);
    box-shadow: 0 4px 12px rgba(94, 28, 38, 0.2) !important;
}

.btn-delete {
    background: #f56565;
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.2) !important;
}

.article-actions .btn-action-sm:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1) !important;
}

.article-actions .btn-action-sm:active {
    transform: translateY(0);
}

.article-actions .btn-action-sm i {
    font-size: 15px;
}

/* --- Modernized Toolbar & Color Picker --- */
.toolbar-dropdown {
    position: relative;
    display: inline-block;
}

.color-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1200;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 15px;
    width: 240px;
    border: 1px solid #edf2f7;
    margin-top: 5px;
}

.color-dropdown-menu.active {
    display: block;
}

.btn-color-main {
    position: relative;
}

.current-color-indicator {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}

.color-picker-header {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f4f8;
}

.color-preview-large {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.hex-input {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px !important;
    height: 28px !important;
    padding: 2px 8px !important;
    margin-bottom: 8px;
}

.btn-color-pick {
    width: 100%;
    height: 28px;
    background: #5e1c26;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.swatch-section {
    margin-bottom: 12px;
}

.swatch-section label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 800;
    color: #a0aec0;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.color-swatch:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.color-swatch.empty {
    background: #f7fafc;
    border: 1px dashed #cbd5e0;
}

/* --- Premium Color Picker Modal Styles --- */
.color-swatch-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.cms-color-circle {
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid transparent;
}

.cms-color-circle:hover {
    transform: scale(1.2) translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.cms-color-circle.active {
    border-color: #5e1c26;
}

.cms-color-circle.empty {
    background: #edf2f7;
    border: 1px dashed #cbd5e0;
    box-shadow: none;
    cursor: default;
}

.cms-color-circle.empty:hover {
    transform: none;
}

.btn-pick-custom:hover {
    background: #4a151e !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(94, 28, 38, 0.3);
}

#colorHexInput:focus {
    background: white !important;
    border-color: #5e1c26 !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(94, 28, 38, 0.1);
}

/* --- Advanced Color Picker (Canvas) --- */
.color-picker-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.btn-eye-dropper {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #edf2f7;
    background: white;
    color: #4a5568;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-eye-dropper:hover {
    background: #f7fafc;
    color: #5e1c26;
    border-color: #5e1c26;
    transform: scale(1.1);
}

.hue-slider-input {
    -webkit-appearance: none;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to right,
            #ff0000 0%,
            #ffff00 17%,
            #00ff00 33%,
            #00ffff 50%,
            #0000ff 67%,
            #ff00ff 83%,
            #ff0000 100%);
    outline: none;
    cursor: pointer;
}

.hue-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border: 2px solid #5e1c26;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.hue-slider-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: white;
    border: 2px solid #5e1c26;
    border-radius: 50%;
    cursor: pointer;
}

/* RESPONSIVE IMPROVEMENTS */
@media (max-width: 768px) {

    /* 1. Header Cleanup: Hide titles/descriptions */
    .cms-main h2,
    .cms-main .text-muted,
    .cms-main>div>div:first-child>h2,
    .cms-main>div>div:first-child>div,
    .cms-main>div>div:first-child>p {
        display: none !important;
    }

    /* Ensure the header container doesn't collapse */
    .cms-main>div:first-child {
        justify-content: flex-end !important;
        margin-bottom: 0 !important;
    }

    /* 2. Floating Action Button (Bottom Right) */
    .cms-main .btn-main-action {
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        z-index: 9999 !important;
        width: 56px !important;
        height: 56px !important;
        padding: 0 !important;
        font-size: 0 !important;
        /* Hide text */
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 50% !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
        background: #5e1c26 !important;
    }

    .cms-main .btn-main-action i {
        font-size: 24px !important;
        margin: 0 !important;
        color: white !important;
    }

    .cms-filters {
        flex-wrap: wrap;
    }

    /* 3. Better Grid for Mobile (2 columns) */
    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 12px !important;
        padding-bottom: 100px !important;
        /* Space for FAB */
    }

    /* High Specificity Overrides */
    #view-cms .cms-main .article-card {
        height: auto !important;
        min-height: 200px !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: visible !important;
    }

    #view-cms .cms-main .article-thumb {
        height: 100px !important;
        flex-shrink: 0 !important;
    }

    #view-cms .cms-main .article-body {
        display: block !important;
        /* No flex to avoid collapse */
        padding: 10px !important;
        height: auto !important;
        overflow: visible !important;
        flex: 1 !important;
    }

    /* Universal reset inside body to unhide anything */
    #view-cms .cms-main .article-body * {
        opacity: 1 !important;
        visibility: visible !important;
    }

    #view-cms .cms-main .article-title {
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #1a202c !important;
        /* Darkest gray */
        line-height: 1.4 !important;
        margin-bottom: 12px !important;
        white-space: normal !important;
        display: block !important;
        height: auto !important;
        max-height: none !important;
    }

    #view-cms .cms-main .article-meta {
        display: none !important;
    }

    #view-cms .cms-main .article-actions {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 10px !important;
        margin-top: 10px !important;
        padding-top: 5px !important;
        border-top: 1px solid #edf2f7 !important;
        width: 100% !important;
        position: relative !important;
        z-index: 50 !important;
    }

    #view-cms .cms-main .btn-action-sm {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
        background: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 8px !important;
        color: #334155 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* 4. Dashboard Scroll Fix */
    #view-dashboard {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        /* Ensure it fills available space but doesn't force display */
        height: 100% !important;
        max-height: 100% !important;
        padding-bottom: 120px !important;
        /* Space for FAB or spacing */
        flex: 1 !important;
    }

    #view-dashboard .dashboard-header>div:first-child {
        display: none !important;
    }
}

/* 5. Tablet-specific fixes */
@media (max-width: 1100px) {
    #view-dashboard {
        overflow-y: auto !important;
        height: 100% !important;
        max-height: 100% !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 100px !important;
    }
}