/* Admin */
.cms-editable-wrapper {
    position: relative;
    display: inline-block;
    transition: outline 0.2s ease;
}
.cms-image-wrapper {
    display: inline-block;
}
.cms-editable-wrapper:hover {
    outline: 2px dashed #8E44AD; 
}
.cms-edit-btn {
    position: absolute;
    top: 50%;
    right: -40px;
    margin-top: -16px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    color: #8E44AD;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.2s ease, background 0.2s ease;
    z-index: 100;
}
.cms-editable-wrapper:hover .cms-edit-btn {
    opacity: 1;
    transform: scale(1.1);
}
.cms-edit-btn:hover {
    background: #8E44AD;
    color: white;
}

/* Modals */
.cms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.cms-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.cms-modal {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255,255,255,0.2);
}
.cms-modal-overlay.active .cms-modal {
    transform: translateY(0) scale(1);
}
.cms-modal h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #222;
    font-family: 'Inter', sans-serif;
    font-size: 22px;
}
.cms-modal-body {
    margin-bottom: 20px;
}
.cms-textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.cms-textarea:focus {
    border-color: #8E44AD;
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.2);
    outline: none;
}
.cms-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.cms-input:focus {
    border-color: #8E44AD;
    outline: none;
}
.cms-file-input {
    width: 100%;
    padding: 20px;
    border: 2px dashed #bbb;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    background: #f9f9f9;
    box-sizing: border-box;
    transition: background 0.2s, border-color 0.2s;
}
.cms-file-input:hover {
    background: #f1f1f1;
    border-color: #8E44AD;
}
.cms-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.cms-btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-size: 14px;
}
.cms-btn:active {
    transform: scale(0.98);
}
.cms-btn-cancel {
    background: #e0e0e0;
    color: #333;
}
.cms-btn-cancel:hover {
    background: #d4d4d4;
}
.cms-btn-save {
    background: #8E44AD;
    color: white;
}
.cms-btn-save:hover {
    background: #6C3483;
}
.cms-admin-link {
    display: inline-block;
    font-size: 12px;
    color: inherit;
    opacity: 0.2;
    text-decoration: none;
    transition: opacity 0.2s;
    margin-left: 10px;
}
.cms-admin-link:hover {
    opacity: 0.8;
}

/* Mobile */
@media (max-width: 768px), (hover: none) {
    .cms-edit-btn {
        opacity: 0.8; 
        top: 0;
        right: -10px;
        margin-top: -15px; 
        transform: scale(0.9);
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    .cms-editable-wrapper:hover .cms-edit-btn,
    .cms-edit-btn:active {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Buttons */
.btn-primary, .btn-secondary, .btn, .btn-outline {
    position: relative;
}
.btn-primary .cms-editable-wrapper,
.btn-secondary .cms-editable-wrapper,
.btn-outline .cms-editable-wrapper,
.btn .cms-editable-wrapper {
    position: static;
}
.btn-primary .cms-edit-btn,
.btn-secondary .cms-edit-btn,
.btn-outline .cms-edit-btn,
.btn .cms-edit-btn {
    right: -40px;
    top: 50%;
    margin-top: -16px;
}
@media (max-width: 768px), (hover: none) {
    .btn-primary .cms-edit-btn,
    .btn-secondary .cms-edit-btn,
    .btn-outline .cms-edit-btn,
    .btn .cms-edit-btn {
        right: -25px;
        top: 50%;
        margin-top: -16px;
    }
}
/* Utilities */
.cms-status-msg { font-size: 12px; margin-bottom: 10px; display: none; }
.cms-error-msg { color: red; }
.cms-action-link { font-size: 12px; color: var(--primary); }
.cms-helper-text { font-size: 12px; color: #666; margin-top: 10px; margin-bottom: 10px; }
.cms-hidden { display: none !important; }
.cms-textarea-tall { height: 100px; }

/* Settings Modal Classes */
.cms-modal-settings { max-width: 700px; width: 95%; }
.cms-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.cms-settings-label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 600; }
.cms-settings-hr { margin: 15px 0; border: 0; border-top: 1px solid #eee; }
.cms-msg-box { padding: 12px; border-radius: 8px; margin-bottom: 15px; font-weight: 600; text-align: center; }
.cms-msg-success { background-color: rgba(142, 68, 173, 0.1); color: #8E44AD; border: 1px solid rgba(142, 68, 173, 0.3); display: block; }
.cms-msg-error { background-color: rgba(255, 59, 48, 0.1); color: #FF3B30; border: 1px solid rgba(255, 59, 48, 0.3); display: block; }

/* Admin Banner */
.cms-admin-banner {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(142, 68, 173, 0.3);
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    animation: cmsSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: #333;
    font-family: 'Inter', sans-serif;
}
.cms-admin-banner-icon {
    background: #8E44AD;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(142, 68, 173, 0.3);
}
.cms-admin-banner-text {
    display: flex;
    flex-direction: column;
}
.cms-admin-banner-text strong {
    font-size: 15px;
    color: #2c3e50;
    margin-bottom: 2px;
}
.cms-admin-banner-text span {
    font-size: 12px;
    color: #666;
}
.cms-admin-banner-text b {
    color: #8E44AD;
    font-weight: 700;
}
/* Tabs in Modal */
.cms-tabs { position: sticky; top: 0; background: rgba(255, 255, 255, 0.98); z-index: 10; padding-top: 10px; display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid #eee; padding-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.cms-tabs::-webkit-scrollbar { display: none; }
.cms-tab-btn { background: none; border: none; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; padding: 5px 10px; transition: color 0.3s; white-space: nowrap; }
.cms-tab-btn:hover { color: #222; }
.cms-tab-btn.active { color: #8E44AD; position: relative; }
.cms-tab-btn.active::after { content: ''; position: absolute; bottom: -12px; left: 0; width: 100%; height: 2px; background: #8E44AD; }
.cms-tab-content { display: none; }
.cms-tab-content.active { display: block; animation: cmsFadeInTab 0.2s ease-in-out; }
@keyframes cmsFadeInTab { from { opacity: 0; } to { opacity: 1; } }

/* Scrollable Body */
.cms-modal-body { max-height: 60vh; overflow-y: auto; overflow-x: hidden; padding-right: 5px; margin-bottom: 20px; }
.cms-modal-settings .cms-modal-body { min-height: 380px; }
.cms-modal-body::-webkit-scrollbar { width: 6px; }
.cms-modal-body::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.cms-modal-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }
.cms-modal-body::-webkit-scrollbar-thumb:hover { background: #aaa; }

@keyframes cmsSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@media (max-width: 768px) {
    .cms-grid-2 { grid-template-columns: 1fr; }
    .cms-admin-banner {
        top: auto;
        bottom: 20px;
        right: auto;
        left: 20px;
        padding: 8px;
        gap: 0;
        border-radius: 50%;
        animation: cmsSlideUpMobile 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    .cms-admin-banner-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
        box-shadow: none;
    }
    .cms-admin-banner-text strong {
        display: none;
    }
    .cms-admin-banner-text span {
        display: none;
    }
    @keyframes cmsSlideUpMobile {
        from { transform: translateY(120%); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }
}
