/* ============================================================================
   MODALS - Wikipedia Dark Mode Theme
   ============================================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #27292a;
    border: 1px solid #3a3b3c;
    border-radius: 2px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #3a3b3c;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #202122;
}

.modal-header h3 {
    margin: 0;
    color: #eaecf0;
    font-size: 1.1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.modal-close {
    background: transparent;
    border: none;
    color: #a2a9b1;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: #3a3b3c;
    color: #eaecf0;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    background: #27292a;
}

.modal-body textarea,
.modal-body input[type="text"],
.modal-body input[type="email"] {
    width: 100%;
    background: #202122;
    border: 1px solid #3a3b3c;
    border-radius: 2px;
    padding: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #eaecf0;
    resize: vertical;
}

.modal-body textarea {
    min-height: 300px;
}

.modal-body textarea:focus,
.modal-body input:focus {
    outline: none;
    border-color: #3366cc;
    box-shadow: 0 0 0 1px rgba(51, 102, 204, 0.3);
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #3a3b3c;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #202122;
}

.modal-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 2px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.cancel-btn {
    background: #202122;
    color: #eaecf0;
    border: 1px solid #3a3b3c;
}

.cancel-btn:hover {
    background: #2a2b2c;
    border-color: #3366cc;
}

.create-btn {
    background: #3366cc;
    color: #ffffff;
    font-weight: 600;
}

.create-btn:hover {
    background: #447ff5;
}

.add-track-btn {
    background: #3366cc;
    color: #ffffff;
    font-weight: 600;
}

.add-track-btn:hover {
    background: #447ff5;
}

.add-track-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Search input group */
.search-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.search-input {
    flex: 1;
    background: #202122;
    border: 1px solid #3a3b3c;
    border-radius: 2px;
    padding: 10px 12px;
    color: #eaecf0;
    font-size: 0.875rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: all 0.15s ease;
}

.search-input:focus {
    outline: none;
    border-color: #3366cc;
    box-shadow: 0 0 0 1px rgba(51, 102, 204, 0.3);
}

.search-btn {
    background: #3366cc;
    border: 1px solid #3366cc;
    border-radius: 2px;
    padding: 10px 20px;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    white-space: nowrap;
}

.search-btn:hover {
    background: #447ff5;
    border-color: #447ff5;
    box-shadow: 0 2px 8px rgba(51, 102, 204, 0.3);
    transform: translateY(-1px);
}

.search-btn:active {
    transform: translateY(0);
}

/* Select elements */
.search-select {
    width: 100%;
    background: #202122;
    border: 1px solid #3a3b3c;
    border-radius: 2px;
    padding: 10px;
    color: #eaecf0;
    font-size: 0.875rem;
    margin-bottom: 8px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.search-select:focus {
    outline: none;
    border-color: #3366cc;
    box-shadow: 0 0 0 1px rgba(51, 102, 204, 0.3);
}

.search-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Operation settings */
.setting-item {
    margin-bottom: 16px;
}

.setting-item label {
    display: block;
    color: #eaecf0;
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.setting-item select {
    width: 100%;
    background: #202122;
    border: 1px solid #3a3b3c;
    border-radius: 2px;
    padding: 10px;
    color: #eaecf0;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.setting-item select:focus {
    outline: none;
    border-color: #3366cc;
    box-shadow: 0 0 0 1px rgba(51, 102, 204, 0.3);
}

/* Checkbox settings */
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(32, 33, 34, 0.5);
    border-radius: 2px;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.checkbox-item:hover {
    background: rgba(42, 43, 44, 0.7);
    border-color: #3a3b3c;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3366cc;
    margin: 0;
}

.checkbox-item label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    user-select: none;
}

.checkbox-item input[type="checkbox"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.checkbox-item:has(input[type="checkbox"]:disabled) {
    opacity: 0.6;
}

.checkbox-item:has(input[type="checkbox"]:disabled) label {
    cursor: not-allowed;
    color: #72777d;
}

.checkbox-item:has(input[type="checkbox"]:disabled):hover {
    background: rgba(32, 33, 34, 0.5);
    border-color: transparent;
}

/* About modal sections */
.about-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #3a3b3c;
}

.about-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.about-section h4 {
    color: #3366cc;
    font-size: 1rem;
    margin-bottom: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.about-section p {
    color: #eaecf0;
    line-height: 1.6;
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    background: rgba(32, 33, 34, 0.6);
    padding: 15px;
    border-radius: 2px;
    border: 1px solid #3a3b3c;
    text-align: center;
    transition: all 0.15s ease;
}

.stat-item:hover {
    background: rgba(42, 43, 44, 0.8);
    border-color: #3366cc;
    transform: translateY(-2px);
}

.stat-item.clickable {
    cursor: pointer;
    position: relative;
}

.stat-item.clickable::after {
    content: '👁️';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.stat-item.clickable:hover::after {
    opacity: 0.6;
}

.stat-item.clickable:hover {
    background: rgba(51, 102, 204, 0.2);
    border-color: #3366cc;
    transform: translateY(-3px);
    box-shadow: 0 2px 8px rgba(51, 102, 204, 0.3);
}

.stat-label {
    color: #a2a9b1;
    font-size: 0.8rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.stat-value {
    color: #3366cc;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* How-to modal */
.howto-body {
    max-height: 70vh;
    overflow-y: auto;
}

.howto-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #3a3b3c;
}

.howto-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.howto-section h4 {
    color: #3366cc;
    font-size: 1.05rem;
    margin-bottom: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.howto-list {
    color: #eaecf0;
    line-height: 1.8;
    font-size: 0.9rem;
    padding-left: 25px;
}

.howto-list li {
    margin-bottom: 10px;
}

.howto-list strong {
    color: #3366cc;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.tips-list li {
    position: relative;
    padding-left: 10px;
}

.tips-list li::before {
    content: '💡';
    position: absolute;
    left: -20px;
}

/* Operations grid */
.operations-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 15px;
}

.op-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(32, 33, 34, 0.6);
    border-radius: 2px;
    border: 1px solid #3a3b3c;
    transition: all 0.15s ease;
}

.op-item:hover {
    background: rgba(42, 43, 44, 0.8);
    border-color: #3366cc;
    transform: translateX(4px);
}

.op-icon {
    font-size: 1.5rem;
    min-width: 30px;
    text-align: center;
}

.op-item strong {
    color: #6b9dff;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.op-item p {
    color: #a2a9b1;
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0;
}

/* Shortcuts grid */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 15px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(32, 33, 34, 0.6);
    border-radius: 2px;
    border: 1px solid #3a3b3c;
}

kbd {
    background: #3a3b3c;
    border: 1px solid #4a4b4c;
    border-radius: 2px;
    padding: 4px 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
    font-size: 0.85rem;
    color: #eaecf0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    min-width: 60px;
    text-align: center;
}

.shortcut-item span {
    color: #eaecf0;
    font-size: 0.85rem;
}

/* Scrollbar for howto */
.howto-body::-webkit-scrollbar {
    width: 8px;
}

.howto-body::-webkit-scrollbar-track {
    background: #27292a;
}

.howto-body::-webkit-scrollbar-thumb {
    background: #3a3b3c;
    border-radius: 5px;
    border: 2px solid #27292a;
}

.howto-body::-webkit-scrollbar-thumb:hover {
    background: #4a4b4c;
}

/* Artists cloud modal - fullscreen */
#artistsCloudModal .modal-content {
    max-width: 95vw;
    max-height: 95vh;
    width: 95vw;
    height: 95vh;
}

#artistsCloudModal .modal-body {
    padding: 0;
    overflow: hidden;
}

.artists-cloud-container {
    width: 100%;
    height: 100%;
    min-height: 600px;
    overflow: hidden;
    padding: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 15px;
    align-items: center;
    justify-content: center;
    align-content: center;
    background: radial-gradient(circle at center, rgba(32, 33, 34, 0.95) 0%, rgba(32, 33, 34, 1) 100%);
    position: relative;
}

.artist-cloud-item {
    display: inline-block;
    padding: 4px 10px;
    margin: 2px 6px;
    text-decoration: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
    transition: all 0.2s ease;
    cursor: pointer;
    line-height: 1.3;
    white-space: nowrap;
    position: relative;
    animation: cloudItemAppear 0.5s ease-out backwards;
}

.artist-cloud-item:nth-child(1) { animation-delay: 0.02s; }
.artist-cloud-item:nth-child(2) { animation-delay: 0.04s; }
.artist-cloud-item:nth-child(3) { animation-delay: 0.06s; }
.artist-cloud-item:nth-child(4) { animation-delay: 0.08s; }
.artist-cloud-item:nth-child(5) { animation-delay: 0.1s; }
.artist-cloud-item:nth-child(n+6) { animation-delay: 0.12s; }

@keyframes cloudItemAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.artist-cloud-item:hover {
    transform: scale(1.15) translateY(-3px);
    text-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
    z-index: 10;
    filter: brightness(1.3);
}

.artist-cloud-item:visited {
    opacity: 0.7;
}

.loading-text {
    color: #a2a9b1;
    font-style: italic;
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}