@import url('https://fastly.jsdelivr.net/npm/galmuri@latest/dist/galmuri.css');

/* 위젯 wrapper가 공간을 차지하지 않도록 */
.widget-widget_jellymusic {
    position: absolute !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

.jellymusic-widget {
    position: fixed;
    top: 100px;
    left: 20px;
    width: 240px;
    height: 380px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: visible;
    z-index: 100000;
    font-family: 'Galmuri11', sans-serif;
    border: 2px solid var(--card-border-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: height 0.3s ease;
    position: relative;
}

.jellymusic-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--card-bg-color);
    opacity: 0.4;
    border-radius: 16px;
    z-index: -1;
}

.jellymusic-widget.minimized {
    height: 40px;
    overflow: hidden;
}

.jellymusic-widget.minimized .jelly-record-container,
.jellymusic-widget.minimized .jelly-info,
.jellymusic-widget.minimized .jelly-controls,
.jellymusic-widget.minimized .jelly-footer {
    display: none;
}

/* 헤더 */
.jelly-header {
    height: 40px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 12px;
    cursor: grab;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.jelly-header:active {
    cursor: grabbing;
}

.jelly-minimize-btn {
    background: var(--primary-color);
    border: 1px solid var(--card-border-color);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--card-bg-color);
    font-size: 10px;
    transition: all 0.2s;
}

.jelly-minimize-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

/* 레코드판 컨테이너 */
.jelly-record-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 15px auto 10px;
}

/* 레코드판 */
.jelly-record {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    position: relative;
    background: #1a1a1a;
    box-shadow:
        0 0 0 2px #2a2a2a,
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.jelly-record.rotating {
    animation: rotate 3s linear infinite;
}

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

/* 레코드 외부 링 */
.record-outer {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        repeating-radial-gradient(
            circle at center,
            #1a1a1a 0px,
            #2a2a2a 1px,
            #1a1a1a 2px
        );
    z-index: 1;
}

/* 썸네일 영역 */
.record-thumbnail {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    z-index: 2;
    box-shadow:
        0 0 0 8px #1a1a1a,
        inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.record-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 중앙 원 (강조 색상) */
.record-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    z-index: 3;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.record-dot {
    width: 8px;
    height: 8px;
    background: var(--card-bg-color);
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 재생 버튼 */
.jelly-play-btn {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--card-bg-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--card-bg-color);
    font-size: 18px;
    transition: all 0.2s;
    z-index: 10;
}

.jelly-play-btn:hover {
    background: var(--secondary-color);
    transform: translateX(-50%) scale(1.1);
}

.jelly-play-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* 정보 영역 */
.jelly-info {
    text-align: center;
    padding: 15px 15px 5px;
}

/* 이전/다음 곡 버튼 */
.jelly-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 5px 0 10px;
}

.jelly-prev-btn,
.jelly-next-btn {
    background: transparent;
    border: 1px solid var(--primary-color);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 9px;
    transition: all 0.2s;
}

.jelly-prev-btn:hover,
.jelly-next-btn:hover {
    background: var(--primary-color);
    color: var(--card-bg-color);
    transform: scale(1.1);
}

.jelly-prev-btn:active,
.jelly-next-btn:active {
    transform: scale(0.95);
}

.jelly-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--content-font-family, 'Galmuri11', sans-serif);
}

.jelly-artist {
    font-size: 12px;
    color: var(--primary-color);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--content-font-family, 'Galmuri11', sans-serif);
}

/* 푸터 */
.jelly-footer {
    display: flex;
    align-items: center;
    margin-left: 4px;
    justify-content: space-between;
    padding: 0 15px 10px;
    gap: 10px;
}

/* 볼륨 조절 */
.jelly-volume-control {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.jelly-volume-control i {
    color: var(--primary-color);
    font-size: 14px;
}

.jelly-volume-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    outline: none;
}

.jelly-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.jelly-volume-slider::-webkit-slider-thumb:hover {
    background: var(--secondary-color);
    transform: scale(1.2);
}

.jelly-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.jelly-volume-slider::-moz-range-thumb:hover {
    background: var(--secondary-color);
    transform: scale(1.2);
}

/* 레코드판 홈 효과 */
.jelly-record::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        repeating-radial-gradient(
            circle at center,
            transparent 0px,
            transparent 2px,
            rgba(255, 255, 255, 0.02) 2px,
            rgba(255, 255, 255, 0.02) 3px
        );
    z-index: 1;
}

/* 플레이리스트 버튼 */
.jelly-playlist-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    margin-left: 2px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 5px;
    flex-shrink: 0;
}

.jelly-playlist-btn:hover {
    color: var(--secondary-color);
    transform: scale(1.1);
}

/* 플레이리스트 모달 */
.jelly-playlist-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200000;
    backdrop-filter: blur(5px);
}

.jelly-playlist-modal.active {
    display: flex;
}

.jelly-playlist-content {
    background: var(--card-bg-color);
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    max-height: 80vh;
    border: 2px solid var(--card-border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.jelly-playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--card-border-color);
}

.jelly-playlist-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--primary-color);
    font-family: 'Galmuri11', sans-serif;
}

.jelly-playlist-close {
    background: transparent;
    border: none;
    color: var(--content-font-color);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.jelly-playlist-close:hover {
    color: var(--primary-color);
}

.jelly-playlist-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* 플레이리스트 추가 섹션 */
.jelly-playlist-add-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.jelly-playlist-url-input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--form-border-color);
    border-radius: 6px;
    background: var(--form-bg-color);
    color: var(--form-text-color);
    font-size: 13px;
    font-family: 'Galmuri11', sans-serif;
}

.jelly-playlist-url-input:focus {
    outline: none;
    border-color: var(--input-focus-border-color, var(--primary-color));
}

.jelly-playlist-add-btn {
    padding: 10px 20px;
    background: var(--primary-color);
    border: none;
    border-radius: 6px;
    color: var(--card-bg-color);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Galmuri11', sans-serif;
    white-space: nowrap;
}

.jelly-playlist-add-btn:hover {
    background: var(--secondary-color);
}

.jelly-playlist-add-btn:active {
    transform: scale(0.98);
}

/* 플레이리스트 목록 */
.jelly-playlist-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
}

.jelly-playlist-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--content-font-color);
    opacity: 0.5;
    font-size: 14px;
}

.jelly-playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    transition: all 0.2s;
    border: 1px solid transparent;
    cursor: move;
    cursor: grab;
}

.jelly-playlist-item:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.jelly-playlist-item.active {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb, 255, 182, 193), 0.1);
}

.jelly-playlist-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.jelly-playlist-item.drag-over {
    border-top: 2px solid var(--primary-color);
    margin-top: 5px;
}

.jelly-playlist-drag-handle {
    color: var(--primary-color);
    opacity: 0.5;
    font-size: 14px;
    cursor: grab;
    flex-shrink: 0;
    padding: 0 5px;
}

.jelly-playlist-drag-handle:hover {
    opacity: 1;
}

.jelly-playlist-item:active .jelly-playlist-drag-handle {
    cursor: grabbing;
}

.jelly-playlist-item img {
    width: 60px;
    height: 45px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.jelly-playlist-item-info {
    flex: 1;
    min-width: 0;
}

.jelly-playlist-item-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jelly-playlist-item-artist {
    font-size: 11px;
    color: var(--primary-color);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jelly-playlist-item-play,
.jelly-playlist-item-remove {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px;
    flex-shrink: 0;
}

.jelly-playlist-item-play:hover {
    color: var(--secondary-color);
    transform: scale(1.2);
}

.jelly-playlist-item-remove:hover {
    color: #ff4444;
    transform: scale(1.2);
}

/* 플레이리스트 푸터 */
.jelly-playlist-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--card-border-color);
}

.jelly-playlist-clear-btn {
    width: 100%;
    padding: 10px;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid #ff4444;
    border-radius: 6px;
    color: #ff4444;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Galmuri11', sans-serif;
}

.jelly-playlist-clear-btn:hover {
    background: #ff4444;
    color: white;
}

.jelly-playlist-clear-btn:active {
    transform: scale(0.98);
}
