/* ファシリテーター抽選アプリ - モダンデザイン */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --primary-color: #667eea;
    --primary-hover: #5568d3;
    --secondary-color: #10B981;
    --danger-color: #f5576c;
    --warning-color: #feca57;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e0e7ff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    height: 100vh;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

/* ヘッダー - コンパクト化 */
.header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 16px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.header h1 {
    font-size: 24px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

/* ナビゲーション */
.nav {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 12px;
    background: var(--bg-light);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
}

.nav-btn:hover {
    background: var(--border-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.nav-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow);
}

/* メインコンテンツ - フレックスで高さ最大化 */
.main-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-xl);
    flex: 1;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.screen {
    display: none;
    height: 100%;
}

.screen.active {
    display: block;
}

/* 抽選画面 - 2カラムレイアウト */
.lottery-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    height: 100%;
}

.lottery-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
}

.lottery-title {
    font-size: 28px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 16px;
}

/* ガチャアニメーション - サイズ調整 */
.gacha-animation {
    width: 100%;
    max-width: 350px;
    height: 350px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.capsule {
    width: 200px;
    height: 200px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4);
    position: relative;
    opacity: 0;
    transform: scale(0.5);
    border: 4px solid rgba(255, 255, 255, 0.3);
}

.capsule.animate {
    animation: capsuleDrop 5s ease-out forwards;
}

@keyframes capsuleDrop {
    0% {
        opacity: 0;
        transform: translateY(-300px) scale(0.5) rotate(0deg);
    }
    20% {
        opacity: 1;
        transform: translateY(20px) scale(1.1) rotate(180deg);
    }
    40% {
        transform: translateY(-10px) scale(0.95) rotate(360deg);
    }
    50% {
        transform: translateY(0) scale(1) rotate(360deg);
    }
    60% {
        transform: translateY(0) scale(1.05) rotate(360deg);
    }
    70% {
        transform: translateY(0) scale(0.98) rotate(360deg);
    }
    80% {
        transform: translateY(0) scale(1.02) rotate(360deg);
    }
    90% {
        transform: translateY(0) scale(1) rotate(360deg);
        box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4);
    }
    95% {
        transform: translateY(0) scale(1.1) rotate(360deg);
        box-shadow: 0 30px 80px rgba(255, 215, 0, 0.6);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(360deg);
        box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4);
    }
}

.capsule-shine {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
    animation: shine 2s infinite;
}

@keyframes shine {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

@keyframes winnerReveal {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes goldPulse {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    50% {
        text-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 60px rgba(255, 215, 0, 0.5);
    }
}

.winner-name {
    font-size: 42px;
    font-weight: 800;
    color: white;
    transition: all 0.3s ease;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.lottery-btn {
    padding: 16px 48px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 16px;
    background: var(--primary-gradient);
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.lottery-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.lottery-btn:hover:not(:disabled)::before {
    left: 100%;
}

.lottery-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.4);
}

.lottery-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 右サイドバー */
.lottery-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding-right: 8px;
}

.lottery-sidebar::-webkit-scrollbar {
    width: 6px;
}

.lottery-sidebar::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 10px;
}

.lottery-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.lottery-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* 除外対象者カード */
.excluded-members {
    padding: 20px;
    background: linear-gradient(135deg, #fff5e6 0%, #ffe5cc 100%);
    border-radius: 16px;
    border: 2px solid #feca57;
    box-shadow: var(--shadow);
}

.excluded-members h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #d97706;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.excluded-list-items {
    display: grid;
    gap: 8px;
}

.excluded-item {
    display: grid;
    grid-template-columns: 70px 1fr 80px;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.excluded-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.excluded-label {
    padding: 4px 8px;
    background: linear-gradient(135deg, #feca57 0%, #ff9a00 100%);
    color: white;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.excluded-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.excluded-date {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
}

/* 抽選対象メンバーカード */
.eligible-members {
    padding: 20px;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-radius: 16px;
    border: 2px solid #4facfe;
    box-shadow: var(--shadow);
}

.eligible-members h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #0369a1;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.member-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.member-tag {
    padding: 6px 12px;
    background: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.member-tag:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.member-tag.excluded {
    background: #fee;
    color: #dc2626;
    text-decoration: line-through;
    opacity: 0.6;
}

/* メンバー管理画面 */
.member-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.member-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.member-list {
    display: grid;
    gap: 12px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    padding-right: 8px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-light);
    border-radius: 12px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.member-item:hover {
    background: white;
    border-color: var(--border-color);
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.member-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-actions {
    display: flex;
    gap: 8px;
}

/* ボタン */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--success-gradient);
    color: white;
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: var(--secondary-gradient);
    color: white;
    box-shadow: var(--shadow);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 入力フォーム */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-input, select.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
    background: white;
    color: var(--text-primary);
}

.form-input:focus, select.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

select.form-input {
    cursor: pointer;
}

/* 履歴画面 */
.history-list {
    display: grid;
    gap: 12px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    padding-right: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-light);
    border-radius: 12px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.history-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.history-item.recent {
    background: linear-gradient(135deg, #fff5e6 0%, #ffe5cc 100%);
    border-color: #feca57;
}

.history-info {
    flex: 1;
}

.history-date {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.history-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.history-badge {
    padding: 6px 16px;
    background: linear-gradient(135deg, #feca57 0%, #ff9a00 100%);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-right: 12px;
}

/* 設定画面 */
.settings-section {
    margin-bottom: 24px;
    padding: 24px;
    background: var(--bg-light);
    border-radius: 16px;
    border: 2px solid var(--border-color);
}

.settings-section h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 700;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

.settings-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* アラート */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.alert-warning {
    background: linear-gradient(135deg, #fff5e6 0%, #ffe5cc 100%);
    color: #92400E;
    border-left: 4px solid #feca57;
}

.alert-info {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0369a1;
    border-left: 4px solid #4facfe;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065F46;
    border-left: 4px solid #10B981;
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
}

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

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--text-light);
    transition: .4s;
    border-radius: 30px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .slider {
    background: var(--primary-gradient);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* レスポンシブ */
@media (max-width: 1200px) {
    .lottery-container {
        grid-template-columns: 1fr 350px;
    }
}

@media (max-width: 968px) {
    .lottery-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .lottery-sidebar {
        max-height: 300px;
    }
    
    .gacha-animation {
        height: 280px;
    }
    
    .capsule {
        width: 160px;
        height: 160px;
    }
    
    .winner-name {
        font-size: 32px;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 12px;
    }

    .header h1 {
        font-size: 20px;
    }

    .main-content {
        padding: 16px;
    }

    .lottery-btn {
        padding: 12px 32px;
        font-size: 16px;
    }

    .member-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}
