/* =============== รีเซ็ตค่าพื้นฐาน =============== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =============== กำหนดสีและฟอนต์ของหน้า =============== */
body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
}

/* =============== คอนเทนเนอร์หลักจัดเรียง 2 คอลัมน์ =============== */
.container {
    display: flex;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   ส่วนด้านซ้าย: โปรไฟล์
   ============================================ */
.sidebar {
    width: 250px;
    flex-shrink: 0;
}

/* การ์ดโปรไฟล์ */
.profile-card {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    border: 2px solid #e94560;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

/* รูปโปรไฟล์ */
.profile-image {
    width: 180px;
    height: 240px;
    margin: 0 auto 15px;
    overflow: hidden;
    border-radius: 6px;
    background: #000;
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ข้อมูลโปรไฟล์ */
.profile-info h1 {
    font-size: 20px;
    margin-bottom: 5px;
    color: #fff;
}

.profile-info p {
    font-size: 12px;
    color: #b0b0b0;
    margin-bottom: 15px;
}

/* ปุ่มแก้ไขโปรไฟล์ */
.customize-btn {
    width: 100%;
    padding: 10px;
    background: #e94560;
    border: none;
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 15px;
    transition: 0.3s;
}

.customize-btn:hover {
    background: #ff5578;
}

/* ข้อมูลสมาชิก */
.profile-details {
    font-size: 11px;
    color: #888;
    border-top: 1px solid #333;
    padding-top: 10px;
}

.profile-details p {
    margin: 5px 0;
}

/* ปุ่มออกจากระบบ */
.logout-btn {
    width: 100%;
    padding: 10px;
    background: #8B0000;
    border: none;
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 15px;
    transition: 0.3s;
}

.logout-btn:hover {
    background: #B22222;
}

/* ============================================
   ส่วนด้านขวา: เนื้อหาหลัก
   ============================================ */
.main-content {
    flex: 1;
}

/* =============== แท็บหมวดหมู่ =============== */
.category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #333;
}

.category-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    transition: 0.3s;
}

.category-tab.active {
    color: #e94560;
    border-bottom-color: #e94560;
}

.category-tab:hover {
    color: #e0e0e0;
}

/* =============== เนื้อหาหมวดหมู่ =============== */
.category-content {
    display: none;
}

.category-content.active {
    display: block;
}

/* ปุ่มที่ด้านบน */
.header-buttons {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: #0f3460;
    border: 2px solid #e0e0e0;
    color: #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: 0.3s;
}

.btn .icon {
    font-size: 24px;
}

.btn:hover {
    background: #1a5490;
    border-color: #e94560;
}

/* ตกแต่งหัวข้อด้วยสัญลักษณ์ */
.decorative-header {
    text-align: center;
    margin: 40px 0;
    font-size: 20px;
    letter-spacing: 4px;
    color: #e0e0e0;
}

/* =============== กริด: จัดเรียงเพลง 2 เพลงต่อแถว =============== */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* การ์ดแต่ละเพลง */
.grid-item {
    background: linear-gradient(135deg, rgba(15, 52, 96, 0.8) 0%, rgba(26, 26, 46, 0.8) 100%);
    border: 2px solid #333;
    border-radius: 8px;
    overflow: hidden;
    transition: 0.3s;
    cursor: pointer;
}

.grid-item:hover {
    border-color: #e94560;
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.3);
}

/* รูปเพลง */
.grid-item-image {
    width: 100%;
    height: 200px;
    background: #000;
    overflow: hidden;
    position: relative;
}

/* ปุ่มเล่น */
.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(233, 69, 96, 0.9);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    z-index: 10;
}

.grid-item:hover .play-btn {
    display: flex;
}

.play-btn:hover {
    background: rgba(233, 69, 96, 1);
    transform: translate(-50%, -50%) scale(1.1);
}

.grid-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* เนื้อหาข้อมูลเพลง */
.grid-item-content {
    padding: 15px;
}

.grid-item-title {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.grid-item-artist {
    font-size: 13px;
    color: #a0a0a0;
    margin-bottom: 8px;
}

.grid-item-duration {
    font-size: 12px;
    color: #888;
}

/* ปุ่มควบคุม (แก้ไข, ลบ, ชื่นชอบ) */
.grid-item-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.grid-item-actions button {
    background: none;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 16px;
    transition: 0.3s;
}

.grid-item-actions button:hover {
    color: #e94560;
}

/* =============== Reactions & Comments =============== */
.reactions-container {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
    flex-wrap: wrap;
}

.reaction-btn {
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid #e94560;
    color: #e0e0e0;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.3s;
}

.reaction-btn:hover {
    background: rgba(233, 69, 96, 0.4);
    transform: scale(1.05);
}

/* Comments Section */
.comments-section {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.comments-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.comment-item {
    background: rgba(15, 52, 96, 0.3);
    border-left: 3px solid #e94560;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 12px;
}

.comment-time {
    font-size: 11px;
    color: #888;
    margin-bottom: 5px;
}

.comment-text {
    color: #e0e0e0;
    word-break: break-word;
    line-height: 1.4;
}

.comment-input-box {
    border-top: 1px solid #333;
    padding-top: 10px;
}

/* ============================================
   Modal: ฟอร์มเพิ่มเพลง
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ซ่อน modal */
.modal.hidden {
    display: none;
}

/* Player Modal */
.player-content {
    background: #1a1a2e;
    border: 2px solid #e94560;
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    height: 85vh;
    max-width: 900px;
    position: relative;
    overflow: hidden;
}

.player-content .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #e0e0e0;
    z-index: 1000;
}

.player-content .close:hover {
    color: #e94560;
}

/* กล่องหลัก modal */
.modal-content {
    background: #1a1a2e;
    border: 2px solid #e94560;
    border-radius: 8px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

/* ปุ่มปิด modal */
.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #e0e0e0;
}

.close:hover {
    color: #e94560;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #fff;
}

/* แท็บเลือก */
.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #333;
}

.tab-btn {
    padding: 10px 15px;
    background: none;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    transition: 0.3s;
}

.tab-btn.active {
    color: #e94560;
    border-bottom-color: #e94560;
}

.tab-btn:hover {
    color: #e0e0e0;
}

/* เนื้อหา Tab */
.tab-content {
    display: none;
}

.tab-content.active {
    display: flex !important;
}

/* ฟอร์ม */
.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ข้อความการโหลด */
.loading {
    text-align: center;
    color: #a0a0a0;
    font-size: 14px;
    margin: 10px 0;
}

/* ช่องป้อนข้อมูล */
.modal-content input {
    padding: 10px;
    background: #0f3460;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 14px;
}

.modal-content input:focus {
    outline: none;
    border-color: #e94560;
}

/* ปุ่มส่งฟอร์ม */
.modal-content button {
    padding: 12px;
    background: #e94560;
    border: none;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: 0.3s;
}

.modal-content button:hover {
    background: #ff5578;
}

/* =============== Wheel Main Container =============== */
.wheel-main {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
    min-height: 600px;
    padding: 20px 0;
}

.wheel-left-panel {
    width: 280px;
    background: linear-gradient(135deg, rgba(15, 52, 96, 0.5) 0%, rgba(26, 26, 46, 0.5) 100%);
    border: 2px solid #333;
    border-radius: 8px;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.wheel-left-panel h3 {
    color: #e94560;
    margin-bottom: 15px;
    text-align: center;
    font-size: 16px;
}

.wheel-items-list {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.wheel-items-list .wheel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 13px;
    color: #e0e0e0;
    border-left: 3px solid #e94560;
}

.wheel-items-list .wheel-item button {
    background: none;
    border: none;
    color: #e94560;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    transition: 0.2s;
}

.wheel-items-list .wheel-item button:hover {
    color: #ff5578;
}

.wheel-input-section {
    display: flex;
    gap: 8px;
    border-top: 1px solid #333;
    padding-top: 15px;
}

.wheel-input-section input {
    flex: 1;
    padding: 8px 12px;
    background: #0f3460;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
}

.wheel-input-section input:focus {
    outline: none;
    border-color: #e94560;
}

.wheel-input-section button {
    padding: 8px 15px;
    background: #e94560;
    border: none;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.3s;
}

.wheel-input-section button:hover {
    background: #ff5578;
}

.wheel-center-section {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* =============== Wheel Container =============== */
.wheel-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 600px;
}

.wheel-wrapper {
    position: relative;
    width: 420px;
    height: 420px;
    margin: 0 auto;
}

.spinning-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        #FF0000 0deg 36deg,
        #FFFFFF 36deg 72deg,
        #2196F3 72deg 108deg,
        #FFFFFF 108deg 144deg,
        #00BF00 144deg 180deg,
        #FFFFFF 180deg 216deg,
        #8B2FA5 216deg 252deg,
        #FFFFFF 252deg 288deg,
        #FF0000 288deg 324deg,
        #FFFFFF 324deg 360deg
    );
    border: 8px solid #FFD700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: transform 0.1s linear;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.spinning-wheel:hover {
    filter: brightness(1.1);
}

.spinning-wheel.spinning {
    animation: spin 4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 20px solid #FFD700;
    z-index: 10;
}

.wheel-result {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: rgba(233, 69, 96, 0.2);
    border-radius: 8px;
    border: 2px solid #e94560;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wheel-result p {
    font-size: 18px;
    color: #e0e0e0;
    margin: 0;
}

/* =============== Responsive Design =============== */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}
