/**
 * Case Study Read More - CSS
 * Version: 1.0.0
 */

/* Wrapper */
.csrm-wrapper {
    position: relative;
}

/* Button wrapper */
.csrm-button-wrapper {
    position: relative;
    z-index: 10;
    padding: 10px 0;
}

/* Toggle Button */
.csrm-toggle-button {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    background-color: #007bff;
    color: #ffffff;
}

.csrm-toggle-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.csrm-toggle-button:active {
    transform: translateY(0);
}

.csrm-toggle-button:focus {
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}

/* Content wrapper - this is dynamically added by JS */
.csrm-content-wrapper {
    position: relative;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.5s ease-in-out;
}

.csrm-content-wrapper.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
}

.csrm-content-wrapper.expanded {
    max-height: none !important;
    overflow: visible !important;
    opacity: 1 !important;
}

/* Fade overlay - not needed for hide/show, but keeping for compatibility */
.csrm-content-wrapper.collapsed::after {
    display: none;
}

/* No fade option */
.csrm-content-wrapper.no-fade::after {
    display: none !important;
}

.csrm-content-wrapper.expanded::after {
    display: none;
}

/* Hide button when content is too short */
.csrm-wrapper.csrm-hide-button .csrm-button-wrapper {
    display: none !important;
}

/* Loading state */
.csrm-wrapper.csrm-loading .csrm-toggle-button {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .csrm-toggle-button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Animation for smooth transitions */
@keyframes csrmFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.csrm-button-wrapper {
    animation: csrmFadeIn 0.3s ease-in-out;
}

/* Icon support (optional) */
.csrm-toggle-button i,
.csrm-toggle-button svg {
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.csrm-wrapper.expanded .csrm-toggle-button i,
.csrm-wrapper.expanded .csrm-toggle-button svg {
    transform: rotate(180deg);
}

/* Accessibility */
.csrm-toggle-button:focus-visible {
    outline: 3px solid #0056b3;
    outline-offset: 3px;
}

/* Print styles */
@media print {
    .csrm-content-wrapper {
        max-height: none !important;
        overflow: visible !important;
    }
    
    .csrm-content-wrapper::after {
        display: none !important;
    }
    
    .csrm-button-wrapper {
        display: none !important;
    }
}

/* ============================================================
   VISTA CS CATEGORY SIDEBAR - STICKY FIX (v1.0.9)
   Targets the category sidebar on /case-studies/ page rendered
   by the Vista Case Studies shortcode (vista-cs-sidebar).
   
   Fix for: When scrolling down, the sticky sidebar items
   (All / Custom Web Application / Ecommerce / Healthcare /
   Multi Retailer Ecommerce) were appearing to go up and get
   cut off behind the fixed site header.
   ============================================================ */

/* Main sticky behavior on the sidebar */
.vista-cs-sidebar {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 120px !important;                    /* offset below fixed header */
    align-self: flex-start !important;        /* required inside flex .vista-cs-main */
    max-height: calc(100vh - 140px) !important;
    overflow-y: auto !important;
    z-index: 5;
}

/* Inner wrapper — make sure it doesn't add extra top space */
.vista-cs-sidebar .vista-cs-sidebar-inner {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Make sure the first category ("All") stays flush with the top */
.vista-cs-sidebar .vista-cs-sidebar-title {
    margin-top: 0 !important;
}
.vista-cs-sidebar .vista-cs-cat-list {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
.vista-cs-sidebar .vista-cs-cat-list li:first-child {
    margin-top: 0 !important;
}

/* Fallback class applied by JS in case element is re-rendered */
.csrm-sticky-sidebar {
    position: -webkit-sticky !important;
    position: sticky !important;
    align-self: flex-start !important;
    overflow-y: auto !important;
    z-index: 5;
}

/* Clean scrollbar for when sidebar is taller than viewport */
.vista-cs-sidebar::-webkit-scrollbar,
.csrm-sticky-sidebar::-webkit-scrollbar {
    width: 6px;
}
.vista-cs-sidebar::-webkit-scrollbar-track,
.csrm-sticky-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.vista-cs-sidebar::-webkit-scrollbar-thumb,
.csrm-sticky-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}
.vista-cs-sidebar::-webkit-scrollbar-thumb:hover,
.csrm-sticky-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Responsive - disable sticky on tablet/mobile */
@media (max-width: 1024px) {
    .vista-cs-sidebar,
    .csrm-sticky-sidebar {
        position: static !important;
        max-height: none !important;
        overflow-y: visible !important;
        top: auto !important;
    }
}

/* WordPress admin bar adjustment - adds 32px when logged in */
body.admin-bar .vista-cs-sidebar,
body.admin-bar .csrm-sticky-sidebar {
    top: 152px !important;
    max-height: calc(100vh - 172px) !important;
}
@media (max-width: 782px) {
    body.admin-bar .vista-cs-sidebar,
    body.admin-bar .csrm-sticky-sidebar {
        top: 166px !important;
    }
}

/* ============================================================
   VISTA CS CARD TYPOGRAPHY (v1.0.12)
   All font sizes, weights, and colors for card titles, category
   labels, read-more links, and descriptions are now controlled
   from the WordPress Dashboard:

   WP Admin → Case Study Fonts

   Dynamic CSS is generated from settings and injected into
   <head> with priority 99, so it overrides everything below.

   This file only contains the non-typography layout styles.
   ============================================================ */

/* Structural spacing for category label (size/color/weight come from dashboard) */
html body .vista-cs-wrap .vista-cs-card .vista-cs-card-cat-label {
    margin-bottom: 8px !important;
}

/* Structural spacing for read-more link (size/color/weight come from dashboard) */
html body .vista-cs-wrap .vista-cs-card .vista-cs-read-more,
html body .vista-cs-wrap .vista-cs-card .vista-cs-read-more[style] {
    display: inline-block !important;
    margin-top: 10px !important;
}
