/* ===================================
   🎵 アニメ楽曲データベース スタイル
   =================================== */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --bg-main: #0f172a;
    --bg-section: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===================================
   🎯 ヒーローセクション
   =================================== */
.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 4rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path fill="%23ffffff" fill-opacity="0.05" d="M0,0 L1200,0 L1200,60 Q600,120 0,60 Z"/></svg>') repeat-x bottom;
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero-title i {
    font-size: 2.8rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.hero-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* ===================================
   📦 コンテナ
   =================================== */
.main-content {
    min-height: calc(100vh - 80px);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===================================
   🔍 検索セクション
   =================================== */
.search-section {
    background: var(--bg-section);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.search-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-label {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.search-label i {
    color: var(--primary);
}

.search-input,
.search-select {
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.search-input:focus,
.search-select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-select option {
    background: var(--bg-section);
    color: var(--text-primary);
}

.search-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===================================
   🔘 ボタン
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
}

/* ===================================
   📊 結果セクション
   =================================== */
.results-section {
    margin-top: 2rem;
}

.results-header {
    margin-bottom: 2rem;
}

.results-title {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-primary);
}

.results-count {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
    background: rgba(99, 102, 241, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
}

/* ===================================
   🎵 楽曲カード
   =================================== */
.music-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.music-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.music-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.music-header {
    padding: 1.5rem;
    background: rgba(99, 102, 241, 0.05);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.music-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
}

.music-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-op {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
}

.badge-ed {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
}

.badge-挿入歌,
.badge-insert {
    background: linear-gradient(135deg, #10b981, #06b6d4);
    color: white;
}

.music-body {
    padding: 1.5rem;
}

.music-info {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.info-item {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.info-item i {
    color: var(--primary);
    width: 20px;
}

.info-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.info-value {
    color: var(--text-primary);
}

.anime-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.anime-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ===================================
   🔗 楽曲リンク
   =================================== */
.music-actions {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.btn-open-links {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-open-links:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* ===================================
   🎭 モーダルウィンドウ
   =================================== */
.music-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.music-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal-container {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(99, 102, 241, 0.05);
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 0;
}

.modal-title i {
    color: var(--primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.modal-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.modal-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: currentColor;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.modal-link:hover::before {
    transform: scaleY(1);
}

.modal-link:hover {
    transform: translateX(8px);
    background: rgba(255, 255, 255, 0.08);
}

.link-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.link-content {
    flex: 1;
}

.link-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.link-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.link-arrow {
    color: var(--text-muted);
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.modal-link:hover .link-arrow {
    transform: translateX(4px);
}

/* モーダルリンクの色設定 */
.modal-link.link-mora {
    border-color: rgba(59, 130, 246, 0.3);
}

.modal-link.link-mora:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.modal-link.link-mora .link-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.modal-link.link-ytmusic {
    border-color: rgba(255, 0, 0, 0.3);
}

.modal-link.link-ytmusic:hover {
    border-color: #ff0000;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.2);
}

.modal-link.link-ytmusic .link-icon {
    background: rgba(255, 0, 0, 0.1);
    color: #ff0000;
}

.modal-link.link-spotify {
    border-color: rgba(30, 215, 96, 0.3);
}

.modal-link.link-spotify:hover {
    border-color: #1ed760;
    box-shadow: 0 4px 12px rgba(30, 215, 96, 0.2);
}

.modal-link.link-spotify .link-icon {
    background: rgba(30, 215, 96, 0.1);
    color: #1ed760;
}

.modal-link.link-apple {
    border-color: rgba(250, 82, 82, 0.3);
}

.modal-link.link-apple:hover {
    border-color: #fa5252;
    box-shadow: 0 4px 12px rgba(250, 82, 82, 0.2);
}

.modal-link.link-apple .link-icon {
    background: rgba(250, 82, 82, 0.1);
    color: #fa5252;
}

/* ===================================
   📭 空の状態
   =================================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 2px dashed var(--border);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-text {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===================================
   📄 ページネーション
   =================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
    padding: 2rem 0;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.pagination-info {
    padding: 0.8rem 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

/* ===================================
   📱 タブレット対応 (900px以下)
   =================================== */
@media (max-width: 900px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-title i {
        font-size: 2.2rem;
    }

    .container {
        padding: 1.5rem;
    }

    .search-section {
        padding: 1.5rem;
    }

    .music-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.2rem;
    }

    .btn-open-links {
        font-size: 0.9rem;
        padding: 0.7rem 1rem;
    }

    .modal-container {
        max-width: 95%;
    }

    .modal-header {
        padding: 1.2rem;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 1.2rem;
    }

    .modal-link {
        padding: 1rem;
    }

    .link-icon {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }

    .link-name {
        font-size: 1rem;
    }
}

/* ===================================
   📱 スマートフォン対応 (768px以下)
   =================================== */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 1.5rem;
    }

    .hero-title {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .container {
        padding: 1rem;
    }

    .search-section {
        padding: 1.2rem;
    }

    .search-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .search-input,
    .search-select {
        font-size: 16px; /* iOS ズーム防止 */
    }

    .search-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .results-title {
        font-size: 1.5rem;
        flex-wrap: wrap;
    }

    .music-grid {
        grid-template-columns: 1fr;
    }

    .music-header {
        padding: 1.2rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .music-title {
        font-size: 1.1rem;
    }

    .music-body {
        padding: 1.2rem;
    }

    .info-item {
        grid-template-columns: auto 1fr;
        gap: 0.3rem;
        display: block;
    }

    .info-label {
        grid-column: 1 / -1;
        margin-bottom: 0.2rem;
    }

    .info-value {
        grid-column: 1 / -1;
    }

    .btn-open-links {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .modal-container {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
        margin-top: auto;
    }

    .modal-header {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .modal-title {
        font-size: 1rem;
        flex: 1;
    }

    .modal-close {
        width: 32px;
        height: 32px;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-description {
        font-size: 0.9rem;
    }

    .modal-links {
        gap: 0.8rem;
    }

    .modal-link {
        padding: 1rem;
    }

    .link-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .link-name {
        font-size: 0.95rem;
    }

    .link-desc {
        font-size: 0.8rem;
    }

    .pagination {
        flex-direction: column;
        gap: 0.8rem;
    }

    .pagination-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* ===================================
   📱 小型スマートフォン対応 (480px以下)
   =================================== */
@media (max-width: 480px) {
    .hero-section {
        padding: 2rem 1rem;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-title i {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .container {
        padding: 0.8rem;
    }

    .search-section {
        padding: 1rem;
        border-radius: 8px;
    }

    .search-input,
    .search-select {
        padding: 0.75rem 0.8rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }

    .results-title {
        font-size: 1.3rem;
    }

    .music-card {
        border-radius: 8px;
    }

    .music-header {
        padding: 1rem;
    }

    .music-title {
        font-size: 1rem;
    }

    .music-body {
        padding: 1rem;
    }

    .music-links {
        flex-direction: column;
    }

    .music-link {
        width: 100%;
        justify-content: center;
    }

    .btn-open-links {
        font-size: 0.85rem;
        padding: 0.7rem 0.9rem;
    }

    .modal-container {
        padding: 0;
    }

    .modal-header {
        padding: 0.9rem;
    }

    .modal-title {
        font-size: 0.95rem;
    }

    .modal-close {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    .modal-body {
        padding: 0.9rem;
    }

    .modal-links {
        gap: 0.7rem;
    }

    .modal-link {
        padding: 0.9rem;
    }

    .link-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .link-name {
        font-size: 0.9rem;
    }

    .link-desc {
        font-size: 0.75rem;
    }

    .empty-state {
        padding: 3rem 1rem;
    }

    .empty-icon {
        font-size: 3rem;
    }

    .empty-title {
        font-size: 1.2rem;
    }
}

/* ===================================
   ⚡ アニメーション
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.music-card {
    animation: fadeIn 0.5s ease-out;
}

.music-card:nth-child(1) { animation-delay: 0.05s; }
.music-card:nth-child(2) { animation-delay: 0.1s; }
.music-card:nth-child(3) { animation-delay: 0.15s; }
.music-card:nth-child(4) { animation-delay: 0.2s; }
.music-card:nth-child(5) { animation-delay: 0.25s; }
.music-card:nth-child(6) { animation-delay: 0.3s; }
