/**
 * 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;
    }
}

/* ==========================================================================
   INSTAGRAM-STYLE OVERLAY DESIGN
   ========================================================================== */

/* Full Screen Container */
.wp-stories-vue-editor-modal.instagram-style .editor-container {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    background: #000;
}

/* Hide native header/actions */
.wp-stories-vue-editor-modal.instagram-style .editor-header {
    display: none;
}

/* Editor Body Full Size */
.wp-stories-vue-editor-modal.instagram-style .editor-body {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Top Bar */
.story-editor-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 1000;
    display: flex;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 100%);
    padding: 0 20px;
}
.story-editor-top-bar .btn-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}
.story-editor-top-bar .btn-close:hover {
    background: rgba(255,255,255,0.1);
}
.story-editor-top-bar .story-title-display {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Right Toolbar */
.story-editor-right-toolbar {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 1000;
}
.story-editor-right-toolbar .tool-btn {
    background: #00000080;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.story-editor-right-toolbar .tool-btn:hover {
    transform: scale(1.1);
    background: rgba(255,255,255,0.1);
}
.story-editor-right-toolbar .tool-btn span {
    font-size: 24px;
    font-weight: 700;
    font-family: serif;
}

/* Bottom Bar */
.story-editor-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 20px 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
}
.story-editor-bottom-bar .user-visibility-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: rgba(0,0,0,0.4);
    padding: 8px 16px 8px 8px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.2);
    transition: background 0.2s;
}
.story-editor-bottom-bar .user-visibility-indicator:hover {
    background: rgba(0,0,0,0.6);
}
.story-editor-bottom-bar .user-avatar,
.story-editor-bottom-bar .user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
}
.story-editor-bottom-bar .user-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #555;
    color: #fff;
}
.story-editor-bottom-bar .visibility-text {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}
.story-editor-bottom-bar .btn-share {
    background: #fff;
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
}
.story-editor-bottom-bar .btn-share:hover {
    transform: scale(1.05);
}

/* Modals Popover */
.story-tool-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
}
.story-tool-modal {
    position: absolute;
    right: 80px; /* Offset from right toolbar */
    top: 50%;
    transform: translateY(-50%);
    background: #333333;
    border-radius: 16px;
    width: 280px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    color: #fff;
    animation: fadeIn 0.15s ease-out;
}
.story-tool-modal h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #eee;
}
.story-tool-modal h3 svg {
    color: #aaa;
}
.story-input {
    width: 100%;
    background: #4a4a4a;
    border: 1px solid #5a5a5a;
    color: #fff;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 0;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.story-input::placeholder {
    color: #999;
}
.story-input:focus {
    outline: none;
    border-color: #888;
}
.cover-preview-area {
    width: 100%;
    height: 160px;
    background: #4a4a4a;
    border: 1px solid #5a5a5a;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin-bottom: 16px;
    overflow: hidden;
}
.cover-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.upload-placeholder {
    color: #aaa;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.visibility-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0;
}
.vis-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #4a4a4a;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s;
}
.vis-option:hover {
    background: #555;
}
.vis-option input {
    margin: 0;
    accent-color: #7289da;
}
.modal-actions {
    display: none; /* Hidden by default, only shown if explicitly inline styled flex */
    gap: 12px;
    justify-content: center;
}
.btn-done, .btn-remove {
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
}
.btn-done {
    background: #555;
    color: #fff;
}
.btn-done:hover {
    background: #666;
}
.btn-remove {
    background: #ff4757;
    color: #fff;
}
.btn-remove {
    background: #ff4757;
    color: #fff;
}

.tui-image-editor-submenu,.tui-image-editor-controls, .tui-image-editor-help-menu {
    display: none !important;
}

.tui-image-editor{
  left: 0px !important;
}
/* ==========================================================================
   INSTAGRAM-STYLE MOBILE RESPONSIVE
   ========================================================================== */

@media screen and (max-width: 768px) {
  .story-tool-modal {
    right: 50%;
    left: auto;
    transform: translate(50%, -50%);
    width: 85%;
    max-width: 300px;
  }

  .story-editor-right-toolbar {
    right: 15px;
  }
}