/* レイアウト */
.main-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* セクション共通スタイル */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    border-radius: 2px;
}

/* 参加者追加セクション */
.add-participant-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.participant-input-container {
    display: grid;
    gap: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.input-with-button {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.participant-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    font-family: inherit;
}

.participant-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.bulk-add-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bulk-input-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bulk-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1.5;
}

.bulk-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.bulk-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* ボタン共通スタイル */
.add-btn, .bulk-add-btn, .clear-btn, .import-btn, .export-btn, 
.clear-all-btn, .start-lottery-btn, .back-to-manage-btn, 
.restart-lottery-btn, .clear-history-btn, .count-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    white-space: nowrap;
}

.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.add-btn, .bulk-add-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.add-btn:hover, .bulk-add-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

.clear-btn {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.clear-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.start-lottery-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 1.1rem;
    padding: 1rem 2rem;
}

.start-lottery-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
}

.start-lottery-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

/* 参加者一覧セクション */
.participants-list-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.list-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.participants-count {
    font-weight: 600;
    color: #6b7280;
    font-size: 0.9rem;
}

.control-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.import-btn, .export-btn, .clear-all-btn {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

.import-btn {
    background: #3b82f6;
    color: white;
}

.import-btn:hover {
    background: #2563eb;
}

.export-btn {
    background: #6b7280;
    color: white;
}

.export-btn:hover:not(:disabled) {
    background: #4b5563;
}

.export-btn:disabled, .clear-all-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.clear-all-btn {
    background: #ef4444;
    color: white;
}

.clear-all-btn:hover:not(:disabled) {
    background: #dc2626;
}

/* 参加者コンテナ */
.participants-container {
    min-height: 200px;
}

.participant-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.participant-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.participant-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.participant-number {
    background: #3b82f6;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: fit-content;
}

.participant-name {
    color: #374151;
    font-weight: 500;
    word-break: break-word;
    line-height: 1.4;
}

.participant-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.edit-participant-btn, .delete-participant-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.edit-participant-btn {
    background: #f59e0b;
    color: white;
}

.edit-participant-btn:hover {
    background: #d97706;
}

.delete-participant-btn {
    background: #ef4444;
    color: white;
}

.delete-participant-btn:hover {
    background: #dc2626;
}

/* 空の状態 */
.empty-state, .empty-history {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-icon {
    width: 4rem;
    height: 4rem;
    color: #d1d5db;
    margin: 0 auto 1rem;
}

.empty-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.empty-subtext {
    color: #9ca3af;
    font-size: 0.9rem;
}

/* 抽選設定セクション */
.lottery-settings-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.settings-container {
    display: grid;
    gap: 2rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-label {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
}

.winner-count-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.count-btn {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    padding: 0.5rem;
    border-radius: 6px;
}

.count-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.winner-count-input {
    width: 80px;
    padding: 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
}

.winner-count-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.count-unit {
    font-weight: 600;
    color: #6b7280;
}

.animation-options {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.option-radio {
    width: 1rem;
    height: 1rem;
    accent-color: #3b82f6;
}

/* 抽選実行セクション */
.lottery-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.lottery-header {
    margin-bottom: 2rem;
    text-align: center;
}

.lottery-info {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.lottery-participants, .lottery-winners {
    background: #f3f4f6;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.lottery-display {
    margin-bottom: 2rem;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.lottery-animation {
    width: 100%;
    max-width: 500px;
    height: 200px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.rotating-names {
    font-size: 1.5rem;
    font-weight: 700;
    color: #374151;
    text-align: center;
    padding: 1rem;
    word-break: break-word;
    animation: none;
}

.rotating-names.spinning {
    animation: spin 0.1s linear infinite;
}

@keyframes spin {
    0% { opacity: 0.3; transform: translateY(-10px); }
    50% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0.3; transform: translateY(10px); }
}

.winners-display {
    text-align: center;
    width: 100%;
}

.winners-title {
    font-size: 2rem;
    font-weight: 700;
    color: #f59e0b;
    margin-bottom: 2rem;
    animation: celebrate 0.8s ease-in-out;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.winners-list {
    display: grid;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.winner-item {
    background: linear-gradient(135deg, #fef3c7, #fde047);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
}

.winner-rank {
    font-size: 0.9rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.5rem;
}

.winner-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #374151;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lottery-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.back-to-manage-btn {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.back-to-manage-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.restart-lottery-btn {
    background: #f59e0b;
    color: white;
}

.restart-lottery-btn:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* 履歴セクション */
.history-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    margin-top: 2rem;
}

.history-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-title::before {
    content: '';
    width: 3px;
    height: 1.25rem;
    background: linear-gradient(135deg, #6b7280, #4b5563);
    border-radius: 2px;
}

.history-container {
    margin-bottom: 1.5rem;
    min-height: 100px;
}

.history-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: #cbd5e1;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.history-date {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
}

.history-info {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #6b7280;
    flex-wrap: wrap;
}

.history-winners {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-winner {
    background: #dbeafe;
    color: #1e40af;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
}

.history-controls {
    display: flex;
    justify-content: flex-end;
}

.clear-history-btn {
    background: #ef4444;
    color: white;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.clear-history-btn:hover:not(:disabled) {
    background: #dc2626;
}

.clear-history-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

/* action-section スタイル */
.action-section {
    margin-top: 3rem;
    margin-bottom: 2rem;
}

/* relatedToolsContainer スタイル */
#relatedToolsContainer {
    margin-top: 3rem;
    margin-bottom: 2rem;
}

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

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .main-container {
        gap: 1.5rem;
    }
    
    .add-participant-section,
    .participants-list-section,
    .lottery-settings-section,
    .lottery-section,
    .history-section {
        padding: 1.5rem;
    }
    
    .list-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .list-controls {
        justify-content: space-between;
    }
    
    .participant-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .participant-info {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .participant-actions {
        align-self: flex-end;
    }
    
    .input-with-button {
        flex-direction: column;
    }
    
    .bulk-actions,
    .control-buttons,
    .lottery-controls,
    .animation-options {
        flex-direction: column;
    }
    
    .settings-container {
        gap: 1.5rem;
    }
    
    .winner-count-container {
        justify-content: center;
    }
    
    .lottery-animation {
        height: 150px;
    }
    
    .rotating-names {
        font-size: 1.2rem;
    }
    
    .winners-title {
        font-size: 1.5rem;
    }
    
    .winner-name {
        font-size: 1.2rem;
    }
    
    .history-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .subtitle {
        font-size: 1rem;
    }
    
    .participant-input,
    .bulk-textarea {
        font-size: 0.9rem;
    }
    
    .lottery-animation {
        height: 120px;
    }
    
    .rotating-names {
        font-size: 1rem;
    }
    
    .winners-title {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }
    
    .winner-name {
        font-size: 1rem;
    }
    
    .winner-item {
        padding: 1rem;
    }
}