/* ガチャシステム全体のスタイル */
.gacha-system {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 20px auto;
    max-width: 1000px;
    padding: 20px;
}

/* タブ */
.tabs {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.tab-button {
    padding: 10px 15px;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-bottom: none;
    margin-right: 5px;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.tab-button:hover {
    background-color: #e9e9e9;
}

.tab-button.active {
    background-color: #fff;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
    font-weight: bold;
}

.tab-pane {
    display: none;
    padding: 20px;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
}

.tab-pane.active {
    display: block;
}

/* フォームスタイル */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    padding: 8px 12px;
    width: 100%;
}

.form-group input[type="checkbox"] {
    margin-right: 5px;
}

.form-actions {
    margin-top: 15px;
}

/* ボタンスタイル */
.primary-button,
.secondary-button,
.danger-button {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.primary-button {
    background-color: #4a90e2;
    color: white;
}

.primary-button:hover {
    background-color: #3a7bc8;
}

.secondary-button {
    background-color: #f0f0f0;
    color: #333;
}

.secondary-button:hover {
    background-color: #e0e0e0;
}

.danger-button {
    background-color: #e74c3c;
    color: white;
}

.danger-button:hover {
    background-color: #c0392b;
}

/* テーブルスタイル */
table {
    border-collapse: collapse;
    width: 100%;
}

table th,
table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

table th {
    background-color: #f5f5f5;
    font-weight: 500;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* 履歴テーブルのスタイル */
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
}

.history-table th,
.history-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.history-table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.history-table tr:hover {
    background-color: #f9f9f9;
}

.history-results-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.history-results-list li {
    margin-bottom: 3px;
    padding: 2px 5px;
    border-radius: 3px;
    display: inline-block;
    margin-right: 5px;
    background-color: rgba(0, 0, 0, 0.05);
}

.empty-history-message {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

/* 履歴フィルターのスタイル */
.history-filters {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.history-filters .form-group {
    margin-right: 15px;
    margin-bottom: 10px;
}

.history-filters label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
}

.history-filters input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
}

.history-filters .form-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

/* アイテム管理セクション */
.config-section {
    margin-bottom: 30px;
}

.item-form {
    background-color: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 20px;
    padding: 15px;
}

.item-list-container {
    margin-bottom: 20px;
}

.probability-summary {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.warning {
    color: #e74c3c;
    font-weight: 500;
    margin-left: 10px;
}

/* ガチャ実行セクション */
.draw-controls {
    background-color: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 20px;
    padding: 15px;
}

.results-container {
    margin-top: 30px;
}

/* 結果表示のスタイル改善 */
.results-display {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

/* 複数結果表示用のグリッドレイアウト */
.multi-results {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    width: 100%;
    margin: 0 auto;
}

.result-item {
    align-items: center;
    background-color: #f9f9f9;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 120px;
    padding: 15px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

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

/* 結果アイテムの内容スタイル */
.result-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    z-index: 2;
}

.result-rarity {
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    z-index: 2;
}

/* キラキラエフェクト用の疑似要素 */
.result-item::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transform: rotate(30deg);
    transition: opacity 0.3s ease;
    z-index: 1;
}

.result-item:hover::before {
    opacity: 0.6;
    animation: shine 1.5s infinite;
}

@keyframes shine {
    0% {
        transform: rotate(30deg) translateY(0);
        opacity: 0;
    }
    25% {
        opacity: 0.5;
    }
    50% {
        transform: rotate(30deg) translateY(-60%);
        opacity: 0;
    }
    100% {
        transform: rotate(30deg) translateY(-120%);
        opacity: 0;
    }
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1 0 auto;
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .multi-results {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .multi-results {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .history-filters {
        grid-template-columns: 1fr;
    }
}

/* 結果コンテンツのスタイル */
.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 5px;
    position: relative;
    z-index: 2;
}

/* レア度バッジのスタイル */
.result-rarity-badge {
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    margin-top: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 特別なエフェクト */
.special-effect {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.8) 100%);
    opacity: 0;
    animation: pulse 2s infinite;
    pointer-events: none;
    z-index: 1;
    border-radius: 8px;
}

@keyframes pulse {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    50% {
        opacity: 0.3;
        transform: scale(1.05);
    }
    100% {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* レア度表示のスタイル */
.item-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.item-rarity {
    background-color: #f0f0f0;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
}

/* レア度に応じた色分け（デフォルト） */
.result-item {
    border: 2px solid #ddd;
}

/* 一般的なレア度の色分け - 改善版 */
.rarity-ssr, .rarity-ur, .rarity-legendary {
    background: linear-gradient(135deg, #ffd700, #ffec8b);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
    border: 2px solid #ffd700;
}

.rarity-sr, .rarity-rare {
    background: linear-gradient(135deg, #c0c0c0, #e6e6e6);
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.6);
    border: 2px solid #a0a0a0;
}

.rarity-r, .rarity-common {
    background: linear-gradient(135deg, #cd7f32, #e6c19a);
    border-color: #cd7f32;
}

.rarity-n, .rarity-normal {
    background: linear-gradient(135deg, #f0f0f0, #ffffff);
    border-color: #f0f0f0;
}

/* 10連ガチャの最後のアイテム強調表示 */
.result-item.last-item {
    position: relative;
    z-index: 1;
}

/* レア度に応じた色分け（デフォルト） */
.result-item {
    border: 2px solid #ddd;
}

/* 一般的なレア度の色分け */
.rarity-ssr, .rarity-ur, .rarity-legendary {
    background: linear-gradient(135deg, #ffd700, #ffec8b);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    border-color: #ffd700;
}

.rarity-sr, .rarity-rare {
    background: linear-gradient(135deg, #c0c0c0, #e6e6e6);
    box-shadow: 0 0 5px rgba(192, 192, 192, 0.5);
    border-color: #c0c0c0;
}

.rarity-r, .rarity-common {
    background: linear-gradient(135deg, #cd7f32, #e6c19a);
    border-color: #cd7f32;
}

.rarity-n, .rarity-normal {
    background: linear-gradient(135deg, #f0f0f0, #ffffff);
    border-color: #f0f0f0;
}

/* デフォルトレア度のスタイル */
.default-rarity {
    background-color: #f8f8f8;
}

.default-badge {
    background-color: #4a90e2;
    color: white;
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 5px;
}

.delete-rarity-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* レア度バッジのスタイル */
.rarity-badge {
    border-radius: 12px;
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    margin-right: 5px;
    padding: 3px 8px;
}

.rarity-badge.rarity-ssr, .rarity-badge.rarity-ur, .rarity-badge.rarity-legendary {
    background-color: #ffd700;
    color: #333;
}

.rarity-badge.rarity-sr, .rarity-badge.rarity-rare {
    background-color: #c0c0c0;
    color: #333;
}

.rarity-badge.rarity-r, .rarity-badge.rarity-common {
    background-color: #cd7f32;
    color: white;
}

.rarity-badge.rarity-n, .rarity-badge.rarity-normal {
    background-color: #f0f0f0;
    color: #333;
}

/* トグルスイッチスタイル */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-switch label:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked + label {
    background-color: #4a90e2;
}

.toggle-switch input:checked + label:before {
    transform: translateX(26px);
}

.help-text {
    display: inline-block;
    font-size: 12px;
    color: #666;
    margin-left: 10px;
}

/* タイミングゲーム */
.timing-meter-container {
    margin: 20px 0;
    text-align: center;
}

.timing-meter {
    background-color: #f0f0f0;
    border-radius: 4px;
    height: 30px;
    margin: 0 auto 15px;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.timing-indicator {
    background: linear-gradient(90deg, #ff5e62, #ff9966);
    height: 100%;
    position: absolute;
    width: 10px;
}

/* 履歴セクション */
.history-filters {
    background-color: #f9f9f9;
    border-radius: 4px;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    margin-bottom: 20px;
    padding: 15px;
}

.history-list-container {
    margin-bottom: 30px;
    max-height: 400px;
    overflow-y: auto;
}

/* 通知スタイル */
#notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: none;
    animation: fadeIn 0.3s ease;
}

#notification.success {
    background-color: #4CAF50;
}

#notification.error {
    background-color: #F44336;
}

#notification.info {
    background-color: #2196F3;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ユーティリティクラス */
.hidden {
    display: none;
}

/* 集計セクション */
.stats-section {
    padding: 20px;
}

.stats-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 5px;
}

.stats-filters input[type="text"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    min-width: 200px;
    box-sizing: border-box;
}

.stats-filters input[type="text"]:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 3px rgba(74, 144, 226, 0.5);
}

.stats-results {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-top: 20px;
}

.stats-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.stats-summary-item {
    display: flex;
    flex-direction: column;
}

.stats-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.stats-value {
    font-size: 1.1em;
    font-weight: bold;
}

.stats-table-container {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

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

.stats-table th {
    background-color: #f5f5f5;
    position: sticky;
    top: 0;
}

.stats-table tr:hover {
    background-color: #f9f9f9;
}

.stats-table td.item-count {
    text-align: center;
    font-weight: bold;
}

.stats-table td.item-percentage {
    text-align: right;
}
