/* リセットCSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本設定 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* メインコンテンツ */
.main {
    flex: 1;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.intro {
    text-align: center;
    margin-bottom: 40px;
}

.intro h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 15px;
}

.intro p {
    font-size: 1.1rem;
    color: #666;
}

/* ペルソナグリッド */
.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.persona-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 25px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.persona-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.persona-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.persona-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.persona-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 15px;
}

.persona-info h3 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 5px;
}

.persona-age {
    color: #666;
    font-size: 0.9rem;
}

.persona-segment {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 15px;
    display: inline-block;
}

.persona-details {
    font-size: 0.95rem;
    color: #555;
}

.persona-details p {
    margin-bottom: 8px;
}

.persona-details strong {
    color: #2c3e50;
}

/* 設定セクション */
.settings {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
}

.settings-group {
    margin-bottom: 20px;
}

.settings-group:last-child {
    margin-bottom: 0;
}

.settings-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.settings-select,
.settings-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.api-key-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.api-key-group .settings-input {
    flex: 1;
}

.settings-select:focus,
.settings-input:focus {
    outline: none;
    border-color: #667eea;
}

.settings-help {
    display: block;
    color: #666;
    font-size: 0.85rem;
    margin-top: 5px;
}

/* APIキー関連スタイル */
.api-status-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.api-status-info h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.api-status-info p {
    color: #555;
    margin-bottom: 15px;
    line-height: 1.6;
}

.api-status-indicator {
    margin-top: 15px;
}

.api-status {
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: 500;
    display: inline-block;
}

.api-status.checking {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.api-status.available {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.api-status.unavailable {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.api-status.error {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-loading {
    color: #6c757d;
    font-style: italic;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-content h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

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

/* ボタン */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-test {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
    min-width: 80px;
}

.btn-test:hover:not(:disabled) {
    background: #218838;
}

.btn-test:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.btn-save {
    background: #17a2b8;
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
    min-width: 60px;
}

.btn-save:hover:not(:disabled) {
    background: #138496;
}

.btn-save:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* フッター */
.footer {
    text-align: center;
    margin-top: 20px;
    color: white;
    opacity: 0.8;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-title {
        font-size: 2rem;
    }
    
    .main {
        padding: 25px;
    }
    
    .persona-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .modal-content {
        margin: 20% auto;
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.persona-card {
    animation: fadeIn 0.6s ease-out;
}

.persona-card:nth-child(even) {
    animation-delay: 0.1s;
}

.persona-card:nth-child(3n) {
    animation-delay: 0.2s;
}

/* ローディング状態 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}