/* ========================================
   오디오북 공통 스타일
   ======================================== */

/* 컨테이너 공통 스타일 */
.audiobook-container,
.player-container,
.admin-container {
    width: 100%;
    box-sizing: border-box;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
}

/* 헤더 공통 스타일 */
.audiobook-header,
.player-header,
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.audiobook-header h1,
.player-header h1,
.admin-header h1 {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

/* ========================================
   오디오북 리스트 페이지 스타일
   ======================================== */

.playlist-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.playlist-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.audiobook-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-top: 20px;
    margin-bottom: 40px;
    align-items: stretch;
}

.audiobook-card {
    position: relative;
    aspect-ratio: 7/10;
    width: 100%;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

/* aspect-ratio 미지원 브라우저 폴백 */
@supports not (aspect-ratio: 1 / 1) {
    .audiobook-card::after {
        content: '';
        display: block;
        padding-top: 133.333%;
    }
}

.audiobook-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.audiobook-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, transparent 50%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 1;
}

.audiobook-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    color: white;
    z-index: 2;
}

.audiobook-special {
    color: #4ecdc4;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.audiobook-title {
    font-size: 16px;
    font-weight: bold;
    color: white;
    margin-bottom: 15px;
    line-height: 1.3;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.audiobook-actions {
    display: flex;
    gap: 8px;
}

/* 버튼 공통 스타일 */
.btn-play,
.btn-playlist,
.btn-remove {
    flex: 1;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-play {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-play:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.btn-playlist {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
}

.btn-playlist:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(78, 205, 196, 0.3);
}

.btn-remove {
    background: linear-gradient(135deg, #ff6b6b 0%, #e74c3c 100%);
    color: white;
}

.btn-remove:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state img {
    width: 120px;
    opacity: 0.5;
    margin-bottom: 20px;
}

/* ========================================
   오디오북 플레이어 페이지 스타일
   ======================================== */

.btn-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    color: white;
    text-decoration: none;
}

.player-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.player-section {
    background: white;
    border-radius: 20px;
    padding: 30px 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.current-playing {
    position: relative;
    text-align: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    aspect-ratio: 7/10;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 40px;
}

.current-playing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.5) 100%);
    border-radius: 20px;
    z-index: 1;
}

.current-playing > * {
    position: relative;
    z-index: 2;
}

.current-image {
    display: none; /* 배경으로 사용하므로 숨김 */
}

.current-title {
    font-size: 28px;
    font-weight: bold;
    color: white;
    margin-bottom: 12px;
    line-height: 1.3;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    max-width: 80%;
}

.current-special {
    font-size: 18px;
    color: #4ecdc4;
    font-weight: bold;
    margin-bottom: 40px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.control-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.control-btn.play-btn {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.progress-section {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10px;
    padding: 0 16px;
}

.progress-container {
    width: 100%;
    height: 36px;
    background: rgba(0,0,0,0.25);
    border-radius: 18px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 18px;
    width: 0%;
    transition: width 0.1s ease;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #764ba2;
    pointer-events: none;
}

.progress-container .time-display {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    transform: translateY(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    pointer-events: none;
}

.playlist-section h2 {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-clear {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.playlist-container {
    max-height: 400px;
    overflow-y: auto;
}

.playlist-container2 {
    max-height: 740px;
    overflow-y: auto;
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.playlist-item:hover {
    background: #e9ecef;
    transform: translateY(5px);
}

.playlist-item.active {
    background: linear-gradient(135deg, #667eea20, #764ba220);
    border: 2px solid #667eea;
}

.playlist-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 15px;
}

.playlist-info {
    flex: 1;
}

.playlist-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.playlist-special {
    font-size: 12px;
    color: #667eea;
    font-weight: bold;
}

.playlist-actions {
    display: flex;
    gap: 8px;
}

.btn-playlist-play,
.btn-playlist-remove {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-playlist-play {
    background: #4ecdc4;
    color: white;
}

.btn-playlist-remove {
    background: #ff6b6b;
    color: white;
}

.btn-playlist-play:hover,
.btn-playlist-remove:hover {
    transform: scale(1.1);
}

.empty-playlist {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* ========================================
   오디오북 관리 페이지 스타일
   ======================================== */

.form-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.form-section h2 {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.audiobook-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.audiobook-table th,
.audiobook-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.audiobook-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
}

.audiobook-table tr:hover {
    background: #f8f9fa;
}

.btn-delete {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.btn-delete:hover {
    background: #ee5a24;
}

.audiobook-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

/* ========================================
   반응형 스타일
   ======================================== */

@media (max-width: 1024px) {
    .audiobook-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .audiobook-container,
    .player-container,
    .admin-container {
        padding: 15px;
    }

    .audiobook-header,
    .player-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    .audiobook-header h1,
    .player-header h1 {
        font-size: 24px;
    }

    .audiobook-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .audiobook-card {
        aspect-ratio: 7/10;
    }

    .audiobook-info {
        padding: 15px;
    }

    .audiobook-title {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .audiobook-special {
        font-size: 11px;
    }

    .btn-play,
    .btn-playlist,
    .btn-remove {
        padding: 12px 12px;
        font-size: 12px;
    }

    .player-main {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .current-image {
        width: 200px;
        height: 200px;
    }

    .current-title {
        font-size: 20px;
    }

    .playlist-item {
        padding: 10px;
    }

    .playlist-thumb {
        width: 50px;
        height: 50px;
    }

    .audiobook-table {
        font-size: 14px;
    }

    .audiobook-table th,
    .audiobook-table td {
        padding: 10px 8px;
    }

    .audiobook-thumb {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .audiobook-container {
        padding: 10px;
    }

    .audiobook-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .audiobook-card {
        aspect-ratio: 7/10;
    }

    .audiobook-info {
        padding: 12px;
    }

    .audiobook-title {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .btn-play,
    .btn-playlist,
    .btn-remove {
        padding: 10px 10px;
        font-size: 11px;
    }
}
