/**
 * Documentation Professional Template Styles
 * Separate CSS file for better organization
 *
 * @package WP_Documentation_Pro
 */

/* CSS Variables */
:root {
    --primary-color: #10b981;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
}

/* Main Documentation Layout */
.professional-doc-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.professional-doc-main-layout {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Left Sidebar */
.professional-doc-left-sidebar {
    width: 280px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 0;
}

.doc-nav-tree {
    padding: 24px 0;
}

/* CSS for helper function output (doc-tree-* classes) */
.doc-tree-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.doc-tree-item {
    margin: 0;
    padding: 0;
}

.doc-tree-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 0;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    transition: all 0.2s ease;
    position: relative;
    margin: 2px 0;
}

.doc-tree-link:hover {
    background: #f8f9fa;
    color: var(--text-primary);
}

.doc-tree-item.active .doc-tree-link {
    background: #f0fdf4;
    color: var(--primary-color);
    font-weight: 500;
    border-left: 3px solid var(--primary-color);
    padding-left: 13px;
}

.doc-tree-item.has-children > .doc-tree-link {
    position: relative;
    padding-right: 30px;
}

.doc-tree-item.has-children > .doc-tree-link::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid #6b7280;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.3s ease;
}

.doc-tree-item.is-open > .doc-tree-link::after {
    transform: translateY(-50%) rotate(90deg);
    border-left-color: var(--primary-color);
}

.doc-tree-item .doc-tree-list {
    margin-left: 20px;
    border-left: 1px solid #e5e7eb;
    padding-left: 12px;
    margin-top: 4px;
}

/* Hide child items by default, show when parent is open */
.doc-tree-item:not(.is-open) > .doc-tree-list {
    display: none;
}

.doc-tree-item.is-open > .doc-tree-list {
    display: block;
}

/* Override any theme font-size inheritance - More aggressive */
.professional-doc-left-sidebar .doc-tree-list,
.professional-doc-left-sidebar .doc-tree-item,
.professional-doc-left-sidebar .doc-tree-link,
.professional-doc-left-sidebar .doc-tree-link * {
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
}

/* Force font size on all elements */
.doc-tree-list li,
.doc-tree-list a,
.doc-tree-item,
.doc-tree-link {
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
}

/* Child Cards Styling */
.doc-child-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.doc-child-card {
    border: 1px solid #e1e5e9 !important;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.2s ease;
    overflow: hidden;
    min-height: 60px !important;
    max-height: 80px !important;
}

.doc-child-card:hover {
    border-color: var(--primary-color) !important;
    border-width: 2px !important;
    border-style: solid !important;
}

.doc-child-card-link:hover {
    text-decoration: none !important;
    color: inherit !important;
}

/* Force hover border effect */
.doc-child-cards .doc-child-card:hover {
    border: 2px solid var(--primary-color) !important;
}

/* Override any theme conflicts */
.professional-doc-main-content .doc-child-card:hover {
    border: 2px solid var(--primary-color) !important;
}

.doc-child-card-link {
    display: flex !important;
    align-items: center;
    padding: 8px 12px !important;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.doc-child-card-content {
    flex: 1;
}

.doc-child-card-title {
    margin: 0 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-child-card-icon {
    font-size: 12px !important;
}

.doc-child-card-arrow {
    margin-left: 16px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.doc-child-card:hover .doc-child-card-arrow {
    color: var(--primary-color);
    transform: translateX(4px);
}

.doc-child-card:hover .doc-child-card-title {
    color: var(--primary-color);
}

/* Main Content */
.professional-doc-main-content {
    flex: 1;
    min-width: 0;
    background: var(--bg-primary);
    overflow-y: auto;
}

.doc-content-header {
    padding: 32px 40px 24px;
    border-bottom: 1px solid var(--border-color);
}

.doc-breadcrumb {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.doc-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

.doc-breadcrumb a:hover {
    color: var(--primary-color);
}

.doc-breadcrumb span {
    margin: 0 8px;
}

.doc-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.2;
}

.doc-meta {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.doc-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-content {
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5,
.doc-content h6 {
    margin-top: 32px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.doc-content h2 {
    font-size: 24px;
    color: var(--text-primary);
}

.doc-content h3 {
    font-size: 20px;
    color: var(--text-primary);
}

.doc-content p {
    margin-bottom: 16px;
    line-height: 1.7;
}

.doc-content ul,
.doc-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.doc-content li {
    margin-bottom: 8px;
}

.doc-content code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

.doc-content pre {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.doc-content pre code {
    background: none;
    padding: 0;
}

.doc-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-secondary);
}

/* Prev/Next Navigation */
.doc-navigation {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.doc-nav-button {
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    flex: 1;
    min-height: 80px;
    justify-content: center;
}

.doc-nav-button:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.doc-nav-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.doc-nav-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Ensure navigation is always visible */
.doc-navigation {
    display: flex !important;
}

.doc-nav-button-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5 !important;
    border-color: #e0e0e0 !important;
}

.doc-nav-button-disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Right Sidebar (TOC) */
.professional-doc-right-sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 24px;
    overflow-y: auto;
    flex-shrink: 0;
}

.doc-toc-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.doc-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.doc-toc-item {
    margin-bottom: 8px;
}

.doc-toc-link {
    display: block;
    padding: 4px 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    border-left: 2px solid transparent;
    padding-left: 8px;
}

.doc-toc-link:hover {
    color: var(--primary-color);
}

.doc-toc-link.active {
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
}

/* Feedback Widget */
.doc-feedback {
    margin-top: 48px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 8px;
    text-align: center;
}

.doc-feedback-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.doc-feedback-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.doc-feedback-button {
    padding: 12px 24px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text-primary);
}

.doc-feedback-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .professional-doc-main-layout {
        flex-direction: column;
    }
    
    .professional-doc-left-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .professional-doc-right-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    .doc-content {
        padding: 24px;
    }
    
    .doc-content-header {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .doc-content {
        padding: 16px;
    }
    
    .doc-content-header {
        padding: 16px;
    }
    
    .doc-title {
        font-size: 24px;
    }
    
    .doc-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .doc-navigation {
        flex-direction: column;
    }
}

/* Dynamic Icons Styles */
.doc-dynamic-icons {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.doc-icons-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.doc-icons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.doc-icon-item {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.doc-icon-item:hover {
    transform: translateY(-2px);
}

.doc-icon-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
    text-align: center;
}

.doc-icon-wrapper:hover {
    background: #e5f3ff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.doc-icon-emoji {
    font-size: 20px;
    margin-bottom: 4px;
    display: block;
}

.doc-icon-title {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    line-height: 1.2;
}

.doc-icon-message {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    animation: slideIn 0.3s ease;
}

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

/* Document Attachments Styles */
.doc-attachments {
    margin-top: 40px;
    padding: 24px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.doc-attachments-title {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-attachments-grid {
    display: grid;
    gap: 16px;
}

.doc-attachment-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.doc-attachment-item:hover {
    background: #f0f9ff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.doc-attachment-icon {
    font-size: 24px;
    margin-right: 16px;
    flex-shrink: 0;
}

.doc-attachment-info {
    flex: 1;
    min-width: 0;
}

.doc-attachment-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-attachment-meta {
    display: flex;
    gap: 12px;
    margin: 0;
    font-size: 12px;
    color: #6b7280;
}

.doc-attachment-type {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.doc-attachment-size {
    font-weight: 500;
}

.doc-attachment-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.doc-attachment-download,
.doc-attachment-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.doc-attachment-download:hover,
.doc-attachment-preview:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.doc-attachment-preview {
    background: #6b7280;
}

.doc-attachment-preview:hover {
    background: #4b5563;
}

/* Image Preview Modal */
.doc-image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.doc-image-preview-modal.active {
    opacity: 1;
    visibility: visible;
}

.doc-image-preview-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.doc-image-preview-content img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.doc-image-preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.doc-image-preview-close:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Responsive attachments */
@media (max-width: 768px) {
    .doc-attachments {
        padding: 16px;
    }
    
    .doc-attachment-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .doc-attachment-icon {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .doc-attachment-info {
        width: 100%;
    }
    
    .doc-attachment-name {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
    
    .doc-attachment-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* AI Assistant Widget Styles */
.wp-doc-ai-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.wp-doc-ai-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color, #10b981);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.wp-doc-ai-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.wp-doc-ai-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 1001;
}

.wp-doc-ai-panel.active {
    display: flex;
}

.wp-doc-ai-header {
    padding: 16px;
    background: var(--primary-color, #10b981) !important;
    color: white !important;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wp-doc-ai-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white !important;
}

.wp-doc-ai-close {
    background: none;
    border: none;
    color: white !important;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-doc-ai-close:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

.wp-doc-ai-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wp-doc-ai-input-wrapper {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.wp-doc-ai-input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
}

.wp-doc-ai-input:focus {
    border-color: var(--primary-color, #10b981);
}

.wp-doc-ai-send {
    padding: 12px;
    background: var(--primary-color, #10b981);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.wp-doc-ai-send:hover {
    background: var(--primary-color, #059669);
}

@media (max-width: 768px) {
    .wp-doc-ai-panel {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}