/**
 * GTPlay - Side Panel (Drawer)
 *
 * Styles for the slide-out panel used to display details without leaving the page.
 * Includes overlay, header, and loading states.
 *
 * @package GTPlay Astra Child
 */

/* --- Overlay --- */
.gtplay-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(var(--gtplay-shadow-base), 0.7);
    backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.gtplay-panel-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* --- Main Panel --- */
.gtplay-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 600px;
    height: 100%;
    background-color: var(--gtplay-bg-main);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--gtplay-shadow-panel);
    display: flex;
    flex-direction: column;
}

.gtplay-panel.is-open {
    transform: translateX(0);
}

/* --- Header Section --- */
.gtplay-panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gtplay-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--gtplay-bg-element);
}

.gtplay-panel-title {
    margin: 0;
    font-size: 1.25rem;
    color: var(--gtplay-text-primary);
    font-weight: 600;
}

.gtplay-panel-close {
    background: transparent;
    border: none;
    color: var(--gtplay-text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    position: relative;
    padding: 0;
    transition: all 0.2s;
    text-indent: -9999px;
    overflow: hidden;
}

.gtplay-panel-close::before,
.gtplay-panel-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2px;
    background-color: currentColor;
    border-radius: 1px;
}

.gtplay-panel-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.gtplay-panel-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.gtplay-panel-close:hover {
    color: var(--gtplay-text-primary);
    background-color: var(--gtplay-bg-element-hover);
}

/* --- Content & Loader --- */
.gtplay-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

/* Typography Spacing Fix */
.gtplay-panel-content h2,
.gtplay-panel-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--gtplay-text-primary);
}

.gtplay-panel-content > *:first-child {
    margin-top: 0;
}

.gtplay-panel-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--gtplay-bg-main);
    z-index: 10;
}

.gtplay-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gtplay-border-light);
    border-top-color: var(--gtplay-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- External Link --- */
.gtplay-panel-header-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gtplay-panel-external-link {
    font-size: 0.85rem;
    color: var(--gtplay-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.gtplay-panel-external-link:hover {
    color: var(--gtplay-text-primary);
}

/* --- Admin Bar Compatibility --- */
@media screen and (min-width: 783px) {
    body.admin-bar .gtplay-panel {
        top: 32px;
        height: calc(100% - 32px);
    }
}

/* --- Responsive Adaptations --- */
@media (max-width: 600px) {
    .gtplay-panel {
        max-width: 100%;
    }
}
