/**
 * Standalone Admin CSS for Test Page
 * Custom styling for the admin system
 * Designed to be portable and work independently
 */

/* Admin Dashboard Styles */
.admin-dashboard {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 400px;
    max-height: 80vh;
    background: #2c3e50;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.admin-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.admin-header {
    background: #34495e;
    color: white;
    padding: 15px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.admin-body {
    padding: 20px;
    background: white;
    border-radius: 0 0 10px 10px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

.admin-section {
    color: #2c3e50;
}

.admin-chat {
    border: 1px solid #bdc3c7;
    border-radius: 8px;
    background: white;
}

.chat-messages {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.chat-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
}

.chat-message.system {
    background: #e8f4fd;
    border-left: 3px solid #3498db;
}

.chat-message.user {
    background: #f8f9fa;
    border-left: 3px solid #95a5a6;
}

.chat-message.ai {
    background: #e8f5e8;
    border-left: 3px solid #27ae60;
}

.chat-input {
    padding: 10px;
}

/* Footer Admin Access */
.admin-access {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.admin-gear {
    transition: all 0.3s ease;
    position: relative;
    font-size: 1.2em;
    padding: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    color: #6c757d !important; /* Dark gray color for visibility */
}

.admin-gear i {
    color: #6c757d !important; /* Ensure the icon itself is visible */
}

.admin-gear:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.admin-gear.logged-in {
    color: #28a745 !important;
    text-shadow: 0 0 10px rgba(40, 167, 69, 0.5) !important;
}

.admin-gear.logged-in::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.8);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Content Editing Styles */
[data-uid] {
    transition: all 0.2s ease;
    position: relative;
}

/* Hover effects permanently disabled */
/*
.admin-editing [data-uid]:hover {
    outline: 2px dashed rgba(0, 123, 255, 0.5);
    outline-offset: 2px;
}
*/

.admin-editing [data-uid] {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
}

/* All hover effects permanently disabled */
/*
.admin-editing [data-uid]:hover {
    background: rgba(0, 123, 255, 0.1);
    border-color: rgba(0, 123, 255, 0.3);
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.2);
}
*/

/* Text Content Containers - HIGHLIGHTING COMPLETELY DISABLED */
/*
.admin-editing.show-highlighting h1,
.admin-editing.show-highlighting h2,
.admin-editing.show-highlighting h3,
.admin-editing.show-highlighting h4,
.admin-editing.show-highlighting h5,
.admin-editing.show-highlighting h6,
.admin-editing.show-highlighting p,
.admin-editing.show-highlighting .edit,
.admin-editing.show-highlighting [data-container="heading"],
.admin-editing.show-highlighting [data-container="paragraph"] {
    position: relative;
    border: 2px solid rgba(52, 152, 219, 0.4);
    border-radius: 8px;
    background: rgba(52, 152, 219, 0.05);
    padding: 8px;
    margin: 4px 0;
    transition: all 0.3s ease;
    z-index: 9998; /* High z-index to appear above overlays */
}
*/

/* All text content hover effects permanently disabled */
/*
.admin-editing h1:hover,
.admin-editing h2:hover,
.admin-editing h3:hover,
.admin-editing h4:hover,
.admin-editing h5:hover,
.admin-editing h6:hover,
.admin-editing p:hover,
.admin-editing .edit:hover,
.admin-editing [data-container="heading"]:hover,
.admin-editing [data-container="paragraph"]:hover {
    border-color: rgba(52, 152, 219, 0.8);
    background: rgba(52, 152, 219, 0.1);
    box-shadow: 0 0 12px rgba(52, 152, 219, 0.3);
    transform: translateY(-1px);
    z-index: 9999; /* Even higher on hover */
}
*/

/* Special hover state for elements detected under overlays - HIGHLIGHTING DISABLED */
/*
.edit-hover {
    border: 2px solid rgba(255, 193, 7, 0.8) !important; /* Yellow border for under-overlay detection */
    background: rgba(255, 193, 7, 0.1) !important;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.5) !important;
    z-index: 10000 !important; /* Highest z-index for under-overlay elements */
    position: relative !important;
}
*/

/* Container divs with data attributes - HIGHLIGHTING COMPLETELY DISABLED */
/*
.admin-editing.show-highlighting [data-uid][data-container*="text"],
.admin-editing.show-highlighting [data-uid][data-container*="header"],
.admin-editing.show-highlighting [data-uid][data-container*="content"],
.admin-editing.show-highlighting [data-uid][data-container*="title"] {
    position: relative;
    border: 1px dashed rgba(52, 152, 219, 0.3);
    border-radius: 6px;
    background: rgba(52, 152, 219, 0.02);
    padding: 4px;
    margin: 2px 0;
    transition: all 0.3s ease;
}
*/

/* All container hover effects permanently disabled */
/*
.admin-editing [data-uid][data-container*="text"]:hover,
.admin-editing [data-uid][data-container*="header"]:hover,
.admin-editing [data-uid][data-container*="content"]:hover,
.admin-editing [data-uid][data-container*="title"]:hover {
    border-color: rgba(52, 152, 219, 0.5);
    background: rgba(52, 152, 219, 0.05);
}
*/

/* Text Content Edit Indicator - For direct H/P tags and .edit class */
.admin-editing h1::before,
.admin-editing h2::before,
.admin-editing h3::before,
.admin-editing h4::before,
.admin-editing h5::before,
.admin-editing h6::before,
.admin-editing p::before,
.admin-editing .edit::before {
    content: "✏️";
    position: absolute;
    top: -8px;
    right: -8px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 10001; /* Higher than edit-hover z-index */
}

/* Container divs get edit indicator only if they don't have editable children */
.admin-editing [data-uid][data-container*="text"]:not(:has(h1, h2, h3, h4, h5, h6, p))::before,
.admin-editing [data-uid][data-container*="header"]:not(:has(h1, h2, h3, h4, h5, h6, p))::before,
.admin-editing [data-uid][data-container*="content"]:not(:has(h1, h2, h3, h4, h5, h6, p))::before,
.admin-editing [data-uid][data-container*="title"]:not(:has(h1, h2, h3, h4, h5, h6, p))::before {
    content: "✏️";
    position: absolute;
    top: -6px;
    right: -6px;
    background: #95a5a6;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Selected Text Container - HIGHLIGHTING DISABLED */
/*
.text-content-selected {
    border-color: #e74c3c !important;
    background: rgba(231, 76, 60, 0.1) !important;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.4) !important;
    animation: textContentPulse 2s infinite;
}

@keyframes textContentPulse {
    0% {
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
    }
    100% {
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.4);
    }
}
*/

/* Image Editing Styles */
.admin-editing img {
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Image hover effects permanently disabled */
/*
.admin-editing img:hover {
    outline: 3px solid #007bff;
    outline-offset: 2px;
    border-radius: 4px;
}
*/

/* Text Selection Styles - HIGHLIGHTING DISABLED */
/*
.text-selected {
    background: rgba(255, 255, 0, 0.3) !important;
    border: 2px dashed #ffc107 !important;
    padding: 2px !important;
}

.image-selected {
    outline: 3px solid #007bff !important;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(0, 123, 255, 0.5) !important;
}
*/

/* Notification Styles */
.admin-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 300px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.admin-notification.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.admin-notification.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.admin-notification.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Loading States */
.admin-loading {
    opacity: 0.6;
    pointer-events: none;
}

.admin-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Content Editor */
.content-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.content-editor-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.content-editor-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-editor-body {
    padding: 20px;
}

.content-editor-footer {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Form Styles */
.admin-form-group {
    margin-bottom: 15px;
}

.admin-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}

.admin-form-group input,
.admin-form-group textarea,
.admin-form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
}

.admin-form-group input:focus,
.admin-form-group textarea:focus,
.admin-form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Button Styles */
.admin-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.admin-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.admin-btn-primary {
    background: #3498db;
    color: white;
}

.admin-btn-primary:hover {
    background: #2980b9;
}

.admin-btn-secondary {
    background: #95a5a6;
    color: white;
}

.admin-btn-secondary:hover {
    background: #7f8c8d;
}

.admin-btn-success {
    background: #27ae60;
    color: white;
}

.admin-btn-success:hover {
    background: #229954;
}

.admin-btn-danger {
    background: #e74c3c;
    color: white;
}

.admin-btn-danger:hover {
    background: #c0392b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-dashboard {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        max-height: 70vh;
    }

    .admin-access {
        bottom: 15px;
        right: 15px;
    }

    .admin-notification {
        left: 20px;
        right: 20px;
        max-width: none;
    }

    .content-editor-content {
        width: 95%;
        margin: 20px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .admin-dashboard {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .admin-header {
        background: #2d2d2d;
    }

    .admin-body {
        background: #1a1a1a;
    }

    .admin-section {
        color: #e0e0e0;
    }

    .admin-chat {
        border-color: #404040;
    }

    .chat-messages {
        border-bottom-color: #404040;
    }

    .chat-message.system {
        background: #2d4a5a;
        border-left-color: #5dade2;
    }

    .chat-message.user {
        background: #2d2d2d;
        border-left-color: #95a5a6;
    }

    .chat-message.ai {
        background: #2d4a3a;
        border-left-color: #58d68d;
    }
}

/* Print Styles */
@media print {
    .admin-dashboard,
    .admin-access,
    .admin-notification {
        display: none !important;
    }
}

/* Accessibility */
.admin-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles */
.admin-btn:focus,
.admin-form-group input:focus,
.admin-form-group textarea:focus,
.admin-form-group select:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Animation Classes */
.admin-fade-in {
    animation: fadeIn 0.3s ease-in;
}

.admin-slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
