/**
 * Content Companion CSS
 * Container styling ONLY - existing component CSS files remain untouched
 * File: content-companion.css
 * Version: 1.0.0
 * @package Platform
 */

/* ==========================================================================
   Container Layouts
   ========================================================================== */

.content-companion-wrapper {
    position: relative;
    z-index: 100;
}

.content-companion-container {
    /* No padding - let individual components handle their own spacing */
}

/* ==========================================================================
   Sticky Positioning Styles
   ========================================================================== */

.content-companion-sticky {
    position: relative;
    z-index: 1000;
    transition: all 0.3s ease-out;
}

/* JavaScript-controlled sticky positioning */
.content-companion-sticky.is-sticky {
    position: fixed;
    z-index: 1000;
    width: var(--cc-sticky-width, 350px);
    min-width: var(--cc-sticky-width, 350px);
    max-width: var(--cc-sticky-width, 350px);
    box-sizing: border-box;
}

.content-companion-sticky.is-sticky.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.content-companion-sticky.is-sticky.is-hidden {
    opacity: 0;
    transform: translateY(-10px);
}

/* Sticky placeholder for layout preservation */
.content-companion-sticky-placeholder {
    display: none;
    visibility: hidden;
}

.content-companion-sticky-placeholder.is-active {
    display: block;
}

/* ==========================================================================
   Animation Transitions (Phase 3 preparation)
   ========================================================================== */

.content-companion-wrapper {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.content-companion-fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: contentCompanionFadeIn 0.3s ease-out forwards;
}

@keyframes contentCompanionFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Component Spacing
   ========================================================================== */

.content-companion-component {
    margin-bottom: 1.5rem;
}

.content-companion-component:not(:last-child) {
    margin-bottom: 1.5rem;
}

.content-companion-component:last-child {
    margin-bottom: 0;
}

/* Component-specific containers (no styling of existing components) */
.content-companion-toc {
    /* Container for table of contents - existing TOC styles remain in table-of-contents.css */
}

/* Remove focus border from entire content-companion wrapper */
.content-companion-wrapper:focus,
.content-companion-wrapper:focus-within {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.content-companion-taxonomy {
    /* Container for taxonomy labels - existing taxonomy styles remain in taxonomy-labels.css */
}

.content-companion-featured-logo {
    /* Container for featured logo - existing logo styles remain in featured-logo.css */
    margin-bottom: 2.8em !important;
}

.content-companion-back-to-top {
    /* Container for back to top - existing back-to-top styles remain in back-to-top.css */
}

/* ==========================================================================
   Template Configurations
   ========================================================================== */

.content-companion-template-default {
    /* Default template - minimal styling */
}

.content-companion-template-case-study {
    /* Case study template - enhanced styling */
}

.content-companion-template-blog-post {
    /* Blog post template - clean styling */
    /* No background - let components handle their own styling */
}

.content-companion-template-insights {
    /* Insights template - professional styling */
    /* No background - let components handle their own styling */
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Widescreen support (Fix for widescreen display issue) */
@media (min-width: 1200px) {
    .content-companion-wrapper {
        /* max-width can be inherited or set as needed by the theme's grid */
    }
    
    .content-companion-container {
        /* padding: 2rem; */
    }

    /* Ensure the sticky element maintains consistent width */
    .content-companion-sticky.is-sticky {
        width: var(--cc-sticky-width, 350px) !important; /* Use a CSS variable for width */
        min-width: var(--cc-sticky-width, 350px) !important;
        max-width: var(--cc-sticky-width, 350px) !important;
        box-sizing: border-box;
    }
}

/* Tablet adjustments */
@media (max-width: 1024px) {
    /* .content-companion-wrapper {
        max-width: 250px;
    } */
    
    .content-companion-container {
        /* padding: 1rem; */
    }
    
    /* .content-companion-component {
        margin-bottom: 1rem;
    } */
}

/* Mobile disablement (CTO requirement) */
@media (max-width: 768px) {
    .content-companion-wrapper {
        display: none !important;
    }
    
    .content-companion-sticky {
        position: static !important;
    }
    
    .content-companion-sticky-placeholder {
        display: none !important;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.content-companion-wrapper:focus-within {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .content-companion-wrapper,
    .content-companion-sticky {
        transition: none;
    }
    
    .content-companion-fade-in {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   High contrast mode support
   ========================================================================== */

@media (prefers-contrast: high) {
    .content-companion-wrapper {
        border: 2px solid currentColor;
        box-shadow: none;
    }
    
    .content-companion-template-case-study {
        border-left-width: 6px;
    }
}

/* ==========================================================================
   Dark mode preparation (Phase 3)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .content-companion-wrapper {
        /* No background, border, or shadow - let components handle their own styling */
    }
    
    .content-companion-template-blog-post {
        /* No background - let components handle their own styling */
    }
    
    .content-companion-template-insights {
        /* No background - let components handle their own styling */
    }
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* GPU acceleration for smooth animations */
.content-companion-sticky.is-sticky {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Prevent layout shifts */
.content-companion-wrapper {
    contain: layout style;
}

/* ==========================================================================
   Debug Mode (Development Only)
   ========================================================================== */

.content-companion-debug .content-companion-wrapper {
    border: 2px dashed #ff0000;
}

.content-companion-debug .content-companion-component {
    border: 1px solid #00ff00;
    position: relative;
}

.content-companion-debug .content-companion-component::before {
    content: attr(class);
    position: absolute;
    top: -20px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 2px 5px;
    font-size: 10px;
    z-index: 1000;
}

/* ==========================================================================
   Error Display (Development)
   ========================================================================== */

.content-companion-error {
    background: #ffebee;
    border: 1px solid #f44336;
    color: #c62828;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin: 8px 0;
}