/* Version: 3.0 */

/* Player Container */
#psp-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#psp-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 99999;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, height 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.psp-container {
    width: 100%;
    max-width: 1280px;
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 auto;
}

/* --- META SECTION --- */
.psp-meta {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    margin-right: 10px;
}

.psp-has-ad .psp-meta {
    flex: 0 0 auto; 
    min-width: 200px;
    max-width: 300px;
}

.psp-cover {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.1);
    transition: width 0.3s ease, height 0.3s ease;
}

#psp-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#psp-cover-placeholder {
    color: inherit;
    opacity: 0.5;
}

.psp-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#psp-title {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

#psp-artist {
    font-size: 13px;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

/* LIVE BADGE */
@keyframes psp-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.psp-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.5);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    align-self: flex-start;
    animation: psp-pulse 2s infinite;
}


/* --- CONTROLS SECTION (Horizontal Group) --- */
.psp-controls {
    display: flex;
    flex-direction: row; /* Horizontal */
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-left: 15px;
    margin-right: 15px;
}

/* Play Button */
#psp-play-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: inherit;
    transition: transform 0.1s, background 0.2s;
    flex-shrink: 0;
}

#psp-play-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

/* Volume Group Pill */
.psp-volume-group {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 6px 12px;
    gap: 8px;
}

.psp-vol-icon {
    opacity: 0.7;
}

#psp-volume {
    width: 70px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
}
#psp-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}


/* --- AD SLOT --- */
.psp-ad-slot {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    overflow: hidden;
    margin: 0 20px;
}
.psp-ad-slot img {
    height: auto;
    object-fit: contain;
}


/* --- RIGHT (Settings) --- */
.psp-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    gap: 12px;
}

.psp-has-ad .psp-right {
    flex: 0 0 auto;
}

#psp-settings-btn {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 4px;
    transition: opacity 0.2s;
}

#psp-settings-btn:hover {
    opacity: 1;
}


/* --- ADMIN MODAL --- */
.psp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.psp-modal-content {
    background: white;
    color: #333;
    width: 90%;
    max-width: 450px;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.psp-modal-header {
    padding: 15px 20px;
    background: #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.psp-modal-header h3 { margin: 0; font-size: 18px; font-weight: 600; }
#psp-modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #666; }
.psp-modal-body { padding: 20px; overflow-y: auto; }

.psp-form-group { margin-bottom: 15px; }
.psp-form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: #374151; }

.psp-checkbox-label { display: flex !important; align-items: center; cursor: pointer; }
.psp-checkbox-label input { margin-right: 8px; width: 16px; height: 16px; }

.psp-form-group input[type="text"],
.psp-form-group input[type="number"] {
    width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px;
}

.psp-grid-2 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.psp-color-input-group { display: flex; gap: 5px; }
.psp-color-input-group input[type="color"] { width: 36px; height: 36px; padding: 0; border: 0; cursor: pointer; flex-shrink: 0; }
.psp-hex-input { width: 100% !important; padding: 6px !important; font-family: monospace; font-size: 12px !important; }

.psp-modal-footer {
    padding: 15px 20px; background: #f9fafb; display: flex; justify-content: flex-end; align-items: center;
    gap: 10px; border-top: 1px solid #e5e7eb; flex-shrink: 0;
}

#psp-save-btn { background: #2563eb; color: white; border: none; padding: 8px 16px; border-radius: 4px; font-weight: 500; cursor: pointer; }
#psp-save-btn:hover { background: #1d4ed8; }
#psp-save-status { color: #059669; font-size: 14px; font-weight: 500; }

/* --- WP ADMIN DASHBOARD STYLES --- */
.psp-admin-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 20px;
}

.psp-admin-main {
    flex: 2;
}

.psp-admin-sidebar {
    flex: 1;
    max-width: 350px;
}

.psp-admin-card {
    background: white;
    padding: 20px;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    margin-bottom: 20px;
}

.psp-info-card {
    background: white;
    padding: 20px;
    border-left: 4px solid #2271b1; /* WP Blue */
    border-right: 1px solid #ccd0d4;
    border-top: 1px solid #ccd0d4;
    border-bottom: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    margin-bottom: 20px;
}

.psp-info-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #1d2327;
    border-bottom: 1px solid #f0f0f1;
    padding-bottom: 10px;
}

.psp-toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    vertical-align: middle;
}
.psp-toggle-switch input { opacity: 0; width: 0; height: 0; }
.psp-toggle-slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc; transition: .4s; border-radius: 34px;
}
.psp-toggle-slider:before {
    position: absolute; content: "";
    height: 16px; width: 16px; left: 3px; bottom: 3px;
    background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .psp-toggle-slider { background-color: #2271b1; }
input:checked + .psp-toggle-slider:before { transform: translateX(18px); }


/* RESPONSIVE */
@media (max-width: 1024px) {
    .psp-ad-slot { display: none !important; }
    .psp-has-ad .psp-meta { flex: 1; max-width: none; }
    .psp-has-ad .psp-controls { margin-left: 15px; margin-right: 15px; }
    .psp-has-ad .psp-right { flex: 1; }
    
    /* Admin Stack */
    .psp-admin-layout { flex-direction: column; }
    .psp-admin-sidebar { max-width: 100%; }
}

@media (max-width: 640px) {
    .psp-title { font-size: 14px; }
    .psp-artist { font-size: 12px; }
    .psp-controls { gap: 8px; }
    #psp-play-btn { width: 40px; height: 40px; }
    .psp-volume-group { display: none; } /* Hide volume on very small screens to save space, or adjust width */
}