/* SQLテンプレート機能専用CSS */

/* メインレイアウト */
.sql-main {
    padding: 20px 0;
}

.sql-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

/* セキュリティ警告バナー */
.security-banner {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.security-warning h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.security-warning ul {
    margin: 0;
    padding-left: 20px;
}

.security-warning li {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
}

/* テンプレート選択エリア */
.template-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 2px solid #e9ecef;
}

.template-section h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

.category-selector {
    margin-bottom: 20px;
}

.category-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.category-dropdown {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    background: #f8f9fa;
    color: #495057;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-dropdown:hover {
    border-color: #007bff;
    background: #e3f2fd;
}

.category-dropdown:focus {
    outline: none;
    border-color: #007bff;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.template-list {
    max-height: 300px;
    overflow-y: auto;
}

.template-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    background: #f8f9fa;
    position: relative;
}

.template-item:hover {
    border-color: #007bff;
    background: #e3f2fd;
}

.template-item.selected {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.template-content {
    flex: 1;
    cursor: pointer;
}

.template-content h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
}

.template-content p {
    margin: 0;
    font-size: 12px;
    opacity: 0.8;
}

.info-button {
    width: 24px;
    height: 24px;
    border: 1px solid #007bff;
    background: white;
    color: #007bff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.info-button:hover {
    background: #007bff;
    color: white;
    transform: scale(1.1);
}

.info-button.active {
    background: #007bff;
    color: white;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
}

.template-item.selected .info-button {
    border-color: white;
    color: white;
}

.template-item.selected .info-button:hover {
    background: white;
    color: #007bff;
}

/* 入力フォームエリア */
.input-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 2px solid #e9ecef;
}

.input-section h2 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    border-bottom: 2px solid #28a745;
    padding-bottom: 8px;
}

.security-notice {
    background: #fff3cd;
    color: #856404;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #ffeaa7;
    font-size: 14px;
    font-weight: 500;
}

.selected-template h3 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 16px;
}

.selected-template p {
    margin: 0 0 20px 0;
    color: #6c757d;
    font-size: 14px;
}

.parameter-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.generate-btn,
.clear-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.generate-btn {
    background: #28a745;
    color: white;
    flex: 1;
}

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

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

.clear-btn {
    background: #6c757d;
    color: white;
    flex: 0 0 auto;
}

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

/* SQL出力エリア */
.output-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 2px solid #e9ecef;
}

.output-section h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    border-bottom: 2px solid #dc3545;
    padding-bottom: 8px;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.output-controls {
    display: flex;
    gap: 8px;
}

.copy-btn,
.format-btn,
.validate-btn {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    background: #f8f9fa;
    color: #495057;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover:not(:disabled),
.format-btn:hover:not(:disabled),
.validate-btn:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #007bff;
}

.copy-btn:disabled,
.format-btn:disabled,
.validate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sql-display {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0;
    min-height: 200px;
    position: relative;
}

.sql-code {
    margin: 0;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #495057;
    background: none;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.validation-result {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
}

.validation-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.validation-result.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* セキュリティガイドライン */
.security-guidelines {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 2px solid #ffc107;
}

.security-guidelines h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.guidelines-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.guideline-item {
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #28a745;
    background: #f8fff9;
}

.guideline-item.danger {
    border-color: #dc3545;
    background: #fff8f8;
}

.guideline-item h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
}

.guideline-item ul {
    margin: 0;
    padding-left: 20px;
}

.guideline-item li {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
}

/* ツールチップスタイル */
.tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    max-width: 350px;
    width: 350px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    display: none;
}

.tooltip.show {
    opacity: 1;
    display: block;
}

/* 矢印は削除 */

.tooltip-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #ffd700;
}

.tooltip-description {
    margin-bottom: 8px;
    color: #e0e0e0;
}

.tooltip-example {
    background: rgba(255,255,255,0.1);
    padding: 8px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    color: #a0e7ff;
    white-space: pre-line;
}

.tooltip-example-label {
    font-size: 11px;
    color: #ccc;
    margin-bottom: 4px;
    font-family: inherit;
}

.tooltip-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    transition: background 0.2s ease;
}

.tooltip-close:hover {
    background: rgba(255,255,255,0.3);
}

/* レスポンシブ対応 */
@media (max-width: 1200px) {
    .sql-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .guidelines-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .form-actions {
        flex-direction: column;
    }
    
    .output-controls {
        flex-wrap: wrap;
        gap: 5px;
    }
}