/* 
 * Toggle Components CSS
 * Consolidated styles for panel and sidebar toggle functionality
 */

/* ===== Toggle Container Styles ===== */
.toggle-container {
    display: flex;
    position: relative;
    width: 100%;
    height: 100%;
}

.left-container,
.right-container {
    flex-direction: row;
}

.top-container {
    flex-direction: column;
}

.toggle-content {
    flex: 1;
    overflow: auto;
    width: 100%;
    height: 100%;
}

/* Don't apply transition on initial page load */
.initial-load .toggle-content {
    transition: none;
}

/* Only apply transition after initial load */
.transition-enabled .toggle-content {
    transition: all 0.3s ease;
}

.toggle-content.hidden,
.toggle-closed .toggle-content {
    opacity: 0;
    max-width: 0;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    flex: 0 !important;
}

/* ===== Toggle Button Styles ===== */
.toggle-button {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background-color: var(--panel-bg, #f5f5f5);
    border: 1px solid var(--border-color, #ddd);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1001; /* Ensure button stays above content */
}

/* Only apply transition after initial load */
.transition-enabled .toggle-button {
    transition: all 0.2s ease;
}

/* Horizontal toggle buttons (left/right) */
.toggle-button-left,
.toggle-button-right {
    width: 20px;
    height: 50px;
    top: 50%;
    transform: translateY(-50%);
}

/* Vertical toggle button (top) */
.toggle-button-top {
    width: 50px;
    height: 20px;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.toggle-button:hover {
    background-color: var(--panel-highlight, #e8e8e8);
}

.toggle-button button {
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color, #333);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
}

.toggle-icon {
    width: 12px;
    height: 12px;
}

/* Only apply transition after initial load */
.transition-enabled .toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-icon.closed {
    transform: rotate(180deg);
}

/* ===== Positioning for toggle buttons ===== */
.toggle-button-left {
    left: 0;
    border-left: none;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.toggle-button-right {
    right: 0;
    border-right: none;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.toggle-button-top {
    border-top: none;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Toggle buttons when container is closed */
.toggle-button.toggle-closed {
    position: fixed;
    z-index: 1001;
}

/* Fixed positioned toggle buttons to prevent shifting */
.toggle-button-left, .toggle-button-right {
    position: fixed;
}

/* ===== Container States ===== */
/* Panel transitions - only applied after initial load */
.transition-enabled .toggle-panel-left,
.transition-enabled .toggle-panel-right,
.transition-enabled .toggle-panel-top {
    transition: all 0.3s ease;
}

/* Container layout adjustments */
.container.toggle-left-closed {
    grid-template-columns: 0 1fr 20%;
}

.container.toggle-right-closed {
    grid-template-columns: 20% 1fr 0;
}

.container.toggle-left-closed.toggle-right-closed {
    grid-template-columns: 0 1fr 0;
}

/* Main content should expand when panels are hidden */
.container.toggle-left-closed .main-content,
.container.toggle-right-closed .main-content {
    flex: 1;
}

/* Ensure container transitions work properly - only after initial load */
.initial-load .container {
    transition: none;
}

.transition-enabled .container {
    transition: grid-template-columns 0.3s ease;
}

/* ===== Dark Mode Support ===== */
[data-theme='dark'] .toggle-button {
    background-color: var(--panel-bg-dark, #2d2d2d);
    border-color: var(--border-color-dark, #444);
}

[data-theme='dark'] .toggle-button:hover {
    background-color: var(--panel-highlight-dark, #3d3d3d);
}

/* ===== Panel Toggle Arrow Styles ===== */
.toggle-icon {
    color: #53AF31 !important;
    fill: #53AF31 !important;
}

.toggle-icon path {
    stroke: #53AF31 !important;
}

[data-theme='dark'] .toggle-icon {
    color: #6BC346 !important;
    fill: #6BC346 !important;
}

[data-theme='dark'] .toggle-icon path {
    stroke: #6BC346 !important;
}
