/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Header */
header {
    position: absolute; /* Overlay on background */
    top: 20px; /* Adjust as needed */
    left: 50%;
    transform: translateX(-50%); /* Center header */
    color: white;
    text-shadow: 2px 2px 5px rgba(255, 255, 255, 0.8);
    font-family: 'GeosansLight', sans-serif;
    font-size: clamp(1.1rem, 2vw, 3rm);
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.8);
}

body {
    background: url('https://cdn.jsdelivr.net/gh/omeiLab/Song-Assets/Arcaea/bg.png') no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    margin: 0;
    padding: 0;
}

@media (max-width: 768) {
    body {
        background-size: contain; 
        background-attachment: scroll; /* 解决 fixed 在移动端失效的问题 */
        background-position: top center; /* 调整对齐方式 */
    }
}

/* Dark overlay effect */
body::before {
    content: "";
    position: fixed; /* Cover the entire screen */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Adjust opacity for darkness */
    z-index: -1; /* Keep it behind everything */
}

.content-wrapper {
    max-width: 1200px; /* Adjust based on preference */
    margin: 105px auto; /* Adds top, left, and right margins */
    background: white; /* Ensures content is readable */
    padding: 20px;
    border-radius: 10px; /* Optional: Adds smooth rounded corners */
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); /* Optional: Adds slight shadow */
}

.container { 
    display: flex;
    justify-content: center;  /* 水平置中 */
    align-items: center;      /* 垂直置中 */
    height: 80px;            /* 確保有高度 */
}

#update {
    text-align: center;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    padding: 5px 15px;
    border: cornflowerblue 2px solid;
    color: cornflowerblue;
}

.filter-header {
    display: flex;
    justify-content: flex-end;  /* 靠右对齐 */
    margin-bottom: 10px;
}

.reset-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    display: flex;
    align-items: center;
    padding-right: 50px;
    padding-top: 20px;
    gap: 5px; /* 图标与文字间距 */
}

.reset-button i {
    font-size: 18px;
}

.reset-button:hover {
    color: #333;
}

/* Filter Section */
#filter {
    margin: 15px; /* Adds space around the filter section */
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    font-family: Arial, sans-serif;
    font-size: 16px;
}

/* Filter Item */
.filter-item {
    display: flex;
    flex-direction: row; /* Icon and label/dropdown on the same row */
    align-items: flex-start;
    gap: 10px; /* Space between icon and content */
    flex: 1 1 calc(50% - 10px);
    max-width: calc(50% - 10px);
    margin-bottom: 15px; /* Space between filter items */
}

/* Icon Style */
.filter-item i {
    font-size: 20px;
    color: #7c3570cb;
    margin-top: 25px; /* Align icon vertically with the content */
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 30px 0 50px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background-color: #eee;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s, transform 0.1s;
}

.pagination button:hover {
    background-color: #ddd;
    transform: translateY(-1px);
}

.pagination button.active {
    background-color: palevioletred;
    color: white;
    font-weight: bold;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination span {
    user-select: none;
    font-size: 14px;
}


/* Content (Label and Dropdown Container) */
.filter-content, .input-container {
    display: flex;
    flex-direction: column; /* Label above the dropdown */
    flex: 1; /* Take remaining space */
    border-bottom: 1px solid #aaa; /* Bottom line only under the dropdown */
    padding-bottom: 5px;
}

/* Label Style */
.filter-content label, .input-container label {
    font-size: 12px;
    margin-bottom: 5px; /* Space between the label and dropdown */
}

/* Select Dropdown */
.filter-content select, .input-container input {
    padding: 8px;
    border: 1px solid #fff;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    width: 100%;
    transition: border-color 0.3s;
    outline: none;
}

.filter-content select:focus {
    outline: none;
    border-color: rgb(209, 84, 186);
}

/* Focus effect for the input box */
.input-container input:focus {
    border-color: #7c3570cb; /* Highlight border when focused */
}


/* Media Query for Smaller Screens */
@media (max-width: 600px) {
    .filter-item {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

/* song grid */
#song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 3px;
    margin-top: 0;
    padding-top: 0;
    margin-bottom: 30px;
    padding-left: 50px;
    justify-content: center;
}

/* single song card */
.song-card {
    position: relative;
    border: 0px solid #e0e0e0; /* Add a light border for better visibility */
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: rgba(255, 255, 255, 0.05);
    width: 140px;
    height: 168px;
    overflow: hidden; /* Prevent content from overflowing */
}

/* Image styles */
.song-card img {
    width: 100%; 
    height: 83%; 
    object-fit: cover; 
    border-radius: 8px; /* Keep consistent rounded corners */
    margin-bottom: 8px; /* Gap between the image and the label */
    opacity: 0;
    transition: opacity 0.4s ease-in, transform 0.4s ease-out;
    transform: translateY(10px);
}

/* Label styles */
.song-card label {
    font-size: 16px; /* Adjust size for better fit */
    font-family: 'Exo', sans-serif;
    font-weight: bold;
    display: block; /* Ensure it takes a full line below the image */
    margin-top: auto; /* Avoid collapsing margins */
    line-height: 1.2; /* Add some spacing within text lines */
}

.song-card label.future, .modal-content label.future, .random-modal-song-item h3.future{
    color: purple; 
}

.song-card label.beyond, .modal-content label.beyond, .random-modal-song-item h3.beyond {
    color: red; 
}

.song-card label.eternal, .modal-content label.eternal, .random-modal-song-item h3.eternal {
    color: plum; 
}

.song-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.song-card .view-details {
    margin-top: 10px;
    padding: 6px 12px;
    font-size: 14px;
    color: #fff;
    background-color: #7c3570cb;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.song-card .view-details:hover {
    background-color: #5e2957;
}

/* loading placehold - breathe light */
.song-card.is-loaded img,
.song-card.is-loaded label {
    opacity: 1;
    transform: translateY(0);
}

.song-card.is-loading {
    pointer-events: none;
    background: linear-gradient(
        90deg, 
        rgba(216, 191, 216, 0.5) 25%, 
        rgba(186, 156, 215, 0.7) 50%, 
        rgba(216, 191, 216, 0.5) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-blink 1.5s infinite linear;
    border-radius: 8px;
}

@keyframes skeleton-blink {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.song-card.is-loading label,
.song-card.is-loading .lock-icon {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lock-icon {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 30px;
    height: 30px;
    background-color: whitesmoke;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.lock-icon i {
    width: 18px;
    height: 18px;
}

/* Modal 基本樣式 */
.modal{
    display: none; /* 預設隱藏 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.25);
}

.modal-content {
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    width: 350px;
    height: 600px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;  /* Stack children vertically */
    justify-content: flex-start;  /* Keep content at the top initially */
    position: relative;  /* Needed for absolute positioning of the button */
}

.modal-content img {
    width: 100%; 
    height: 50%; 
    object-fit: cover; 
    margin-bottom: 8px; /* Gap between the image and the label */
}

.modal-content h3 {
    font-size: 25px;
    font-family: "Kazesawa-Semibold";
    text-align: start;
}

.modal-content h3.light {
    color: rgb(122, 210, 228);
}

.modal-content h3.conflict {
    color: blueviolet;
}

.modal-content h3.achromic {
    color: rgb(173, 170, 170);
}

.modal-content h3.lephon {
    color: rgb(179, 197, 203);
}

.modal-content p {
    font-size: 12px;
    font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
    font-weight: 500;
    text-align: start;
    color: rgb(94, 93, 93);
    margin-top: 5px;
}

.modal-content label {
    font-size: 18px; /* Adjust size for better fit */
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    font-weight: 900;
    text-align: start;
    display: block; /* Ensure it takes a full line below the image */
    margin-top: auto; /* Avoid collapsing margins */
    line-height: 1.2; /* Add some spacing within text lines */
    margin-top: 15px;
    margin-bottom: 15px;
}

.modal-content label.future {
    background-color: rgba(128, 0, 128, 0.2);
}

.modal-content label.beyond {
    background-color: rgba(255, 0, 0, 0.2);
}

.modal-content label.eternal {
    background-color: rgba(221, 160, 221, 0.2);
}

.modal-content .close:hover {
    color: #7c3570cb;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal.hidden {
    display: none;
}

.random-modal.hidden {
    display: None;
}

/* Random Button*/
.button-container {
    display: flex;
    justify-content: center;  /* 水平置中 */
    align-items: center;      /* 垂直置中 */
    height: 5vh;            /* 讓容器撐滿整個畫面 */
    margin-bottom: 25px;      /* 留出空間 */
    gap: 50px;
    margin-bottom: 30px;
}

/* 按鈕樣式 */
#random-button {
    display: flex;
    align-items: center;  /* 讓 icon & 文字對齊 */
    gap: 8px;            /* icon 和文字之間的間距 */
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background-color: palevioletred; /* 紅色調 */
    color: white;
    cursor: pointer;
    transition: 0.2s ease-in-out;
}

#random-button-multiple {
    display: flex;
    align-items: center;  /* 讓 icon & 文字對齊 */
    gap: 8px;            /* icon 和文字之間的間距 */
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background-color: rgb(147, 153, 215); /* 紅色調 */
    color: white;
    cursor: pointer;
    transition: 0.2s ease-in-out;
}

/* hover 效果 */
#random-button:hover {
    background-color: #e60000;
    transform: scale(1.05);
}

#random-button-multiple:hover {
    background-color: blue;
    transform: scale(1.05);
}

#random-button:disabled, #random-button-multiple:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none; /* Prevents any interaction with the button */
}

#pick-again-button {
    align-self: flex-end;  /* Align button to the right */
    margin-top: auto;  /* Push the button to the bottom */
    padding: 12px 24px;
    gap: 8px;
    font-size: 12px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background-color: palevioletred;
    color: white;
    cursor: pointer;
    transition: 0.2s ease-in-out;
}

/* Pick Again Button */
#pick-again-button {
    margin-top: 20px;
    background-color: palevioletred;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

#pick-again-button:hover {
    background-color: rgb(209, 84, 186);
}

/* Basic reset and modal background */
.random-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 半透明背景 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* 显示 modal */
.random-modal.show {
    visibility: visible;
    opacity: 1;
}

/* Modal content box */
.random-modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 60%;
    max-width: 600px; /* Limit width */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Slight shadow for depth */
    text-align: center;
}

.random-modal-song-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    text-align: center;
}

.random-modal-song-item img {
    width: 150px; /* 或适当大小 */
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.random-modal-song-item img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.random-modal-song-item h3 {
    font-size: 16px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sanif;
    text-align: center;
}

@media (max-width: 600px) {
    /*
    .random-modal-song-grid {
        grid-template-columns: 1fr;
    }*/

    .random-modal-content {
        width: 80%;
    }

    /* Add responsiveness to images */
    .random-modal-song-grid img {
        width: 100%;  /* Makes the images take up the full width of their container */
        height: auto;  /* Maintains the aspect ratio */
    }
}



/* Button inside modal */
#pick-again-button-multiple {
    font-size: 12px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background-color: rgb(147, 153, 215);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

#pick-again-button-multiple:hover {
    background-color: #306dae;
}

.powered-by {
    text-align: center; /* Center the text */
    color: gray; /* Set the text color to gray */
    font-size: 14px; /* Set a smaller font size */
    margin-top: 1px; /* Add some space above the text */
    font-family: Arial, sans-serif;
}

.powered-by a {
    color: blue; /* Set the link text color to gray */
    text-decoration: none; /* Remove underline from the link */
}

.powered-by a:hover {
    text-decoration: underline; /* Add underline on hover */
}
