/* DB 쿼리 실행기 스타일 */
.db-query-container {
    font-family: 'NotoSans', Arial, sans-serif;
    width: 100%;
    padding: 20px;
    margin-top: 60px;
    clear: both;
    margin-left: 0;
    margin-right: 0;
    text-align: left;
}

.db-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.db-card-header {
    background-color: #202342;
    color: white;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.db-card-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

.db-card-body {
    padding: 12px;
}

/* 트랜잭션 컨트롤 */
.transaction-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.transaction-status {
    font-weight: 500;
    color: #333;
    padding: 5px 0;
    flex-grow: 1;
    font-size: 12px;
}

.transaction-buttons {
    display: flex;
    gap: 6px;
}

/* 쿼리 폼 */
.query-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.query-type-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.query-type-container label {
    font-weight: 500;
    color: #333;
    font-size: 12px;
}

.db-select {
    padding: 6px 8px;
    border-radius: 3px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    font-size: 12px;
    width: 90px;
    color: #333;
}

/* 감지된 쿼리 타입 표시 영역 */
.detected-query-type-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 10px;
}

.detected-query-type-container label {
    font-weight: 500;
    color: #495057;
    font-size: 12px;
    margin: 0;
}

.detected-query-type {
    font-weight: bold;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 3px;
    background-color: #6c757d;
    color: white;
    min-width: 60px;
    text-align: center;
}

.detected-query-type.select {
    background-color: #28a745;
}

.detected-query-type.insert {
    background-color: #007bff;
}

.detected-query-type.update {
    background-color: #ffc107;
    color: #212529;
}

.detected-query-type.delete {
    background-color: #dc3545;
}

.detected-query-type.commit {
    background-color: #17a2b8;
}

.detected-query-type.rollback {
    background-color: #6f42c1;
}

.db-textarea {
    width: 100%;
    height: 130px;
    padding: 8px;
    border-radius: 3px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    resize: vertical;
    color: #333;
}

.db-textarea:focus, .db-select:focus {
    outline: none;
    border-color: #202342;
    box-shadow: 0 0 0 2px rgba(32, 35, 66, 0.1);
}

.query-button-container {
    display: flex;
    justify-content: flex-start;
}

/* 버튼 스타일 */
.db-btn {
    padding: 6px 12px;
    border-radius: 3px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.db-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.db-btn:active {
    transform: translateY(1px);
}

.db-btn:disabled {
    background-color: #e0e0e0;
    color: #a0a0a0;
    cursor: not-allowed;
    transform: none;
}

.db-btn-primary {
    background-color: #202342;
    color: white;
}

.db-btn-success {
    background-color: #28a745;
    color: white;
}

.db-btn-danger {
    background-color: #dc3545;
    color: white;
}

/* 결과 컨테이너 */
.db-results-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.db-results-section {
    width: 100%;
}

.db-results-section h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
}

/* 쿼리 히스토리 */
.query-history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 6px 8px;
    margin-bottom: 4px;
    background-color: #f9f9f9;
    border-radius: 3px;
    cursor: pointer;
    border-left: 3px solid #202342;
    transition: all 0.2s ease;
}

.history-item:hover {
    background-color: #f0f0f0;
    transform: translateX(2px);
}

.history-time {
    color: #666;
    margin-right: 8px;
    font-size: 11px;
}

.history-type {
    font-weight: bold;
    margin-right: 8px;
    display: inline-block;
    width: 60px;
    color: #202342;
    font-size: 11px;
}

.history-query {
    white-space: pre-wrap;
    display: block;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 36px;
    color: #333;
    font-family: 'Consolas', monospace;
    font-size: 11px;
}

/* 결과 정보 */
.result-info {
    padding: 6px 8px;
    margin-bottom: 8px;
    border-radius: 3px;
    font-weight: 500;
    font-size: 11px;
}

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

.result-info.error {
    background-color: #f8d7da;
    color: #ff0000;
    border: 1px solid #f5c6cb;
}

/* 테이블 컨트롤 */
.table-controls {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-button {
    background-color: #6c757d;
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    font-size: 11px;
}

.copy-status {
    color: #28a745;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.3s;
}

.copy-status.visible {
    opacity: 1;
}

/* 테이블 스타일 */
.result-table-container {
    overflow: hidden;
    border-radius: 4px;
}

.top-scrollbar {
    overflow-x: auto;
    overflow-y: hidden;
    height: 20px;
}

.top-scrollbar-child {
    height: 1px;
}

.table-container {
    overflow-x: auto;
    max-height: 250px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
}

.result-table th, .result-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    font-size: 12px;
}

.result-table th {
    background-color: #f5f5f5;
    position: sticky;
    top: 0;
    font-weight: 500;
    color: #333;
}

.result-table tr:hover {
    background-color: #f9f9f9;
}

/* 반응형 스타일 */
@media (max-width: 768px) {
    .transaction-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .transaction-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .query-type-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .db-select {
        width: 100%;
    }
}

.results-card {
    text-align: left;
    margin-left: 0;
    margin-right: auto;
}
