/**
 * WP Stories Vue Editor Styles - Production Ready
 * Clean, optimized styles for Vue-based TUI Image Editor
 */

/* ==========================================================================
   MODAL STRUCTURE
   ========================================================================== */

.wp-stories-vue-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.wp-stories-vue-editor-modal .editor-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.wp-stories-vue-editor-modal .editor-container {
    position: relative;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    max-height: 900px;
    background: #1e1e1e;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

/* ==========================================================================
   CUSTOM HEADER
   ========================================================================== */

.wp-stories-vue-editor-modal .editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1e1e1e 100%);
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.wp-stories-vue-editor-modal .editor-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wp-stories-vue-editor-modal .editor-title svg {
    color: #ffd700;
}

.wp-stories-vue-editor-modal .editor-title h2 {
    color: #fff;
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wp-stories-vue-editor-modal .editor-actions {
    display: flex;
    gap: 12px;
}

.wp-stories-vue-editor-modal .editor-actions button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wp-stories-vue-editor-modal .btn-save {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.wp-stories-vue-editor-modal .btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.wp-stories-vue-editor-modal .btn-cancel {
    background: #333;
    color: #aaa;
}

.wp-stories-vue-editor-modal .btn-cancel:hover {
    background: #444;
    color: #fff;
}

/* ==========================================================================
   TUI EDITOR INTEGRATION
   ========================================================================== */

.wp-stories-vue-editor-modal .editor-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #1e1e1e;
}

.wp-stories-vue-editor-modal .tui-image-editor-container {
    width: 100%;
    height: 100%;
    background: #1e1e1e;
    position: relative;
    transition: none;
}

.wp-stories-vue-editor-modal .tui-image-editor {
    width: 100%;
    height: 100%;
}

/* Hide TUI header - we use custom header */
.wp-stories-vue-editor-modal .tui-image-editor-header {
    display: none;
}

/* ==========================================================================
   CANVAS POSITIONING
   ========================================================================== */

.wp-stories-vue-editor-modal .tui-image-editor-canvas-container {
    background: #1a1a1a;
    overflow: hidden; /* No scrolling */
}

.wp-stories-vue-editor-modal .lower-canvas,
.wp-stories-vue-editor-modal .upper-canvas {
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Prevent any overflow in the editor wrap */
.wp-stories-vue-editor-modal .tui-image-editor-wrap {
    width: 100%;
    height: 100%;
    overflow: hidden; /* No scrolling */
    position: relative;
}

/* Left menu layout - following TUI structure */
.wp-stories-vue-editor-modal.left .tui-image-editor-main-container {
    left: 64px;
    width: calc(100% - 64px);
    height: 100%;
}

.wp-stories-vue-editor-modal.left .tui-image-editor-controls {
    width: 64px;
    height: 100%;
    display: table;
}

/* ==========================================================================
   MENU STYLING
   ========================================================================== */

.wp-stories-vue-editor-modal .tui-image-editor-menu {
    background: #2a2a2a;
    border-color: #333;
}

.wp-stories-vue-editor-modal .tui-image-editor-item {
    background: transparent;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.wp-stories-vue-editor-modal .tui-image-editor-item:hover {
    background: #333;
}

.wp-stories-vue-editor-modal .tui-image-editor-item.active {
    background: #444;
}

/* ==========================================================================
   SUBMENU STYLING
   ========================================================================== */

.wp-stories-vue-editor-modal .tui-image-editor-submenu {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Specific left layout submenu positioning */
.wp-stories-vue-editor-modal.left .tui-image-editor-submenu {
    left: 64px;
    height: 100%;
    width: 248px;
}

.wp-stories-vue-editor-modal .tui-image-editor-submenu-item {
    background: transparent;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #ccc;
    padding: 8px 12px;
    font-size: 13px;
}

.wp-stories-vue-editor-modal .tui-image-editor-submenu-item:hover {
    background: #333;
    color: #fff;
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */

@media screen and (max-width: 768px) {
    .wp-stories-vue-editor-modal .editor-container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .wp-stories-vue-editor-modal .editor-header {
        padding: 10px 15px;
        min-height: 60px;
    }
    
    .wp-stories-vue-editor-modal .editor-title h2 {
        font-size: 16px;
    }
    
    .wp-stories-vue-editor-modal .editor-actions button {
        padding: 10px 15px;
        font-size: 14px;
        min-width: 44px;
        min-height: 44px;
    }

}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

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

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   LOADING STATE
   ========================================================================== */

.wp-stories-vue-editor-modal .editor-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
}

.wp-stories-vue-editor-modal .editor-loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #333;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* ==========================================================================
   ACCESSIBILITY & COMPATIBILITY
   ========================================================================== */

.wp-stories-vue-editor-modal button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

body.admin-bar .wp-stories-vue-editor-modal {
    z-index: 100000;
}

@media print {
    .wp-stories-vue-editor-modal {
        display: none;
    }
}