/**
 * プロンプト管理ツール - メインスタイルシート
 * 全体のスタイル定義
 */

/* 基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* ヘッダー */
.header {
    background: linear-gradient(135deg, #4a90e2 0%, #7b68ee 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-text h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.header-text p {
    opacity: 0.9;
    font-size: 14px;
    margin: 0;
}

/* ヘッダーアクション */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.data-button {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.data-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.export-button:hover {
    box-shadow: 0 3px 10px rgba(255, 255, 255, 0.2);
}

.import-button:hover {
    box-shadow: 0 3px 10px rgba(255, 255, 255, 0.2);
}

.create-button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.create-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* コンテナ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 統計情報 */
.stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

/* 検索エリア */
.search-area {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.search-button {
    padding: 10px 20px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.search-button:hover {
    background: #357abd;
}

/* カテゴリタブ */
.category-tabs {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.category-tab {
    padding: 8px 16px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.category-tab:hover {
    background: #e0e0e0;
}

.category-tab.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

/* プロンプトグリッド */
.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* プロンプトカード */
.prompt-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    min-width: 300px;
    overflow: hidden;
}

.prompt-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.prompt-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #2c3e50;
}

.prompt-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.prompt-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.tag {
    padding: 4px 10px;
    background: #e8f4f8;
    color: #4a90e2;
    border-radius: 12px;
    font-size: 12px;
}

.prompt-variables {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.variable {
    color: #e74c3c;
    font-weight: bold;
}

.prompt-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    overflow: hidden;
}

.action-button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-button:hover {
    background: #f0f0f0;
}

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

.action-button.primary:hover {
    background: #357abd;
}

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

.modal-content {
    position: relative;
    background: white;
    margin: 50px auto;
    padding: 30px;
    width: 90%;
    max-width: 800px;
    border-radius: 8px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 900px;
}

.modal-small {
    max-width: 500px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

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

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-textarea {
    min-height: 200px;
    resize: vertical;
    font-family: monospace;
}

/* 編集モーダル用スタイル */
.form-help {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.error-message {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

.form-input.error {
    border-color: #e74c3c;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

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

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

/* 削除モーダル用スタイル */
.delete-content {
    text-align: center;
}

.warning-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.prompt-preview {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
    text-align: left;
}

.prompt-preview h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.prompt-preview p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

/* トースト通知 */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: none;
    z-index: 2000;
    transition: opacity 0.3s;
}

.toast.success {
    background: #27ae60;
}

.toast.error {
background: #e74c3c;
}
        
        .toast.warning {
            background: #f39c12;
        }

.toast.info {
    background: #3498db;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .data-actions {
        justify-content: center;
    }
    
    .container {
        padding: 10px;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .prompts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .modal-content {
        margin: 20px auto;
        padding: 20px;
        width: 95%;
    }
    
    .category-tabs {
        justify-content: center;
    }
    
    .category-tab {
        font-size: 12px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 20px;
    }
    
    .header p {
        font-size: 12px;
    }
    
    .prompt-card {
        padding: 15px;
        min-width: 280px;
    }
    
    .prompt-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-button {
        text-align: center;
        width: 100%;
        box-sizing: border-box;
    }
}

/* インポート/エクスポートモーダル */
.import-preview {
    text-align: left;
}

.import-summary {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.import-summary p {
    margin: 5px 0;
    font-size: 14px;
}

.import-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.import-warning h4 {
    color: #856404;
    margin-bottom: 10px;
}

.import-warning ul {
    margin: 10px 0;
    padding-left: 20px;
    color: #856404;
}

.import-warning li {
    margin: 5px 0;
    font-size: 13px;
}

.import-warning p {
    color: #856404;
    font-size: 13px;
    margin: 10px 0 0 0;
}

.import-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background: #357abd;
    transform: translateY(-1px);
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

/* ============================================ */
/* 変数入力モーダル (ISSUE-1201) */
/* ============================================ */

.variable-modal-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.prompt-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
}

.prompt-info h3 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 18px;
}

.prompt-info p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

.variable-form {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
}

.variable-form-header {
    margin-bottom: 20px;
}

.variable-form-header h4 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 16px;
}

.variable-help {
    margin: 0;
    color: #6c757d;
    font-size: 13px;
}

.variable-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.variable-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.variable-input-label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.variable-required {
    color: #e74c3c;
    font-size: 12px;
}

.variable-input-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.variable-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.variable-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.variable-input.error {
    border-color: #e74c3c;
    background-color: #fdf2f2;
}

.variable-history-btn {
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #6c757d;
    transition: all 0.2s;
    white-space: nowrap;
}

.variable-history-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.variable-history-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-height: 120px;
    overflow-y: auto;
    min-width: 150px;
    margin-top: 2px;
}

.variable-history-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s;
}

.variable-history-item:hover {
    background-color: #f8f9fa;
}

.variable-history-item:last-child {
    border-bottom: none;
}

.variable-error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
}

.variable-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.variable-preview {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
}

.variable-preview h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
}

.preview-content {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.preview-text {
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #2c3e50;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.preview-text.placeholder {
    color: #6c757d;
    font-style: italic;
}

/* 変数ハイライト */
.variable-highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid #ffeaa7;
    font-weight: 500;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .variable-modal-content {
        gap: 15px;
    }
    
    .variable-form {
        padding: 15px;
    }
    
    .variable-input-wrapper {
        flex-direction: column;
        gap: 5px;
    }
    
    .variable-history-btn {
        width: 100%;
        text-align: center;
    }
    
    .variable-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .variable-actions .action-button {
        width: 100%;
    }
    
    .preview-content {
        max-height: 150px;
    }
    
    .preview-text {
        font-size: 12px;
    }
}
