/* リセットとベース */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* ビュー制御 */
.view {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ログイン画面 */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
    font-size: 1.5rem;
}

/* フォーム */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-group.half {
    flex: 1;
}

/* ボタン */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #219a52;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
}

/* 音声入力ボタン */
.voice-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.voice-btn:hover {
    background-color: #e8f4fc;
}

.voice-btn .mic-icon {
    font-size: 1.2rem;
}

.voice-btn.recording {
    background-color: #fee;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ヘッダー */
header {
    background: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.3rem;
    color: #2c3e50;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

#user-display-name {
    color: #666;
}

/* メインコンテンツ */
main {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
}

section {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 24px;
}

section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.2rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

/* 生成ステータス */
#generation-status {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* KY項目表示 */
#ky-items-container {
    margin-bottom: 24px;
}

.ky-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    background: #fafafa;
}

.ky-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ky-item-type {
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.ky-item-type.safety {
    background-color: #e3f2fd;
    color: #1976d2;
}

.ky-item-type.environment {
    background-color: #e8f5e9;
    color: #388e3c;
}

.ky-item-category {
    font-size: 0.85rem;
    color: #666;
}

.ky-item-content {
    display: grid;
    gap: 12px;
}

.ky-item-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
}

.ky-item-label {
    font-weight: 500;
    color: #555;
}

.risk-values {
    display: flex;
    gap: 24px;
}

.risk-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.risk-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
}

.risk-low {
    background-color: #c8e6c9;
    color: #2e7d32;
}

.risk-medium {
    background-color: #fff9c4;
    color: #f57f17;
}

.risk-high {
    background-color: #ffcdd2;
    color: #c62828;
}

/* アクションボタン */
.action-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    text-align: center;
    min-width: 300px;
}

.modal-content h3 {
    margin-bottom: 24px;
    color: #2c3e50;
}

#voice-status {
    margin-bottom: 24px;
}

.recording-indicator {
    width: 60px;
    height: 60px;
    background-color: #e74c3c;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: recording-pulse 1.5s ease-in-out infinite;
}

@keyframes recording-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* エラーメッセージ */
.error-message {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 12px;
    text-align: center;
}

/* レスポンシブ */
@media (max-width: 600px) {
    .login-container {
        margin: 20px;
        padding: 24px;
    }

    header {
        flex-direction: column;
        gap: 12px;
    }

    main {
        padding: 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .action-buttons {
        flex-direction: column;
    }

    .risk-values {
        flex-direction: column;
        gap: 8px;
    }
}

/* マスキング警告（入力時） */
.masking-warning {
    font-size: 12px;
    color: #d68910;
    margin-top: 4px;
    padding-left: 4px;
}

/* マスキング通知（生成結果上部） */
.masking-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #e8f4fd;
    border: 1px solid #b3d7f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.masking-notice .notice-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.masking-notice .notice-text {
    font-size: 14px;
    color: #1a5276;
}
