/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: white;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 0.5in, #d3d3d3 0.5in, #d3d3d3 calc(0.5in + 1px)),
        repeating-linear-gradient(90deg, transparent, transparent 0.5in, #d3d3d3 0.5in, #d3d3d3 calc(0.5in + 1px));
    color: #333;
    line-height: 1.6;
}

#logoNew {
	padding: 0 0 0 20px;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 20px 0;
	border-radius: 8px;
    border: 2px solid #d3d3d3;
    background-color: white;
}

.header-left {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.header-label {
    color: #666;
    font-size: 1rem;
    font-weight: 500;
}

header h1 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    flex: 1;
    margin: 0;
    white-space: nowrap;
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 0 5px;
}

.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-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

/* Prompt Builder */
.prompt-builder {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 10px;
    width: 100%; /* Match container width */
    max-width: 1200px; /* Same as .container max-width */
}

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

.prompt-builder-header h3 {
    color: #2c3e50;
    font-size: 1.25rem;
    margin: 0;
}

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

.prompt-textarea-container {
    position: relative;
    width: 100%;
}

#promptBuilder {
    width: 100%;
    max-width: 100%; /* Prevent horizontal expansion */
    min-width: 100%; /* Prevent horizontal shrinking */
    min-height: 126px; /* 6 lines: 6 * 21px line-height */
    height: 126px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 14px; /* Line height equal to font size */
    resize: vertical; /* Allow only vertical resizing */
    background-color: #fafafa;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

#promptBuilder:focus {
    outline: none;
    border-color: #3498db;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.prompt-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

#promptCount {
    font-weight: 500;
}

/* Button modifications */
.btn-insert {
    background-color: #27ae60;
    color: white;
}

.btn-insert:hover:not(:disabled) {
    background-color: #219a52;
}

.btn-insert:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Filters */
.filters {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

.filter-controls {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: nowrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    flex-shrink: 0;
}

.filter-group label {
    font-weight: 500;
    margin-bottom: 5px;
    color: #555;
}

.filter-group select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    transition: border-color 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #3498db;
}

/* Align Clear button with dropdowns */
#clearFilters {
    align-self: flex-end;
    height: 36px; /* Match select height: 14px font + 8px padding top + 8px padding bottom + 4px border */
}

/* Table */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed; /* Enable fixed table layout for column width control */
}

/* Responsive column widths using percentages */
.col-id {
    width: 8%;
}

.col-industry {
    width: 18%;
    word-break: break-all; /* Breaks words at any character */
}

.col-purpose {
    width: 20%;
}

.col-guardrail {
    width: auto; /* Takes remaining space */
}

.col-actions {
    width: 15%;
    text-align: center;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .col-id {
        width: 10%;
    }
    
    .col-industry {
        width: 20%;
    }
    
    .col-purpose {
        width: 22%;
    }
    
    .col-actions {
        width: 18%;
    }
}

thead {
    background-color: white;
    color: #2c3e50;
    border: 2px solid #d3d3d3;
}

thead th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

/* Center align the actions column header */
thead th.col-actions {
    text-align: center;
}

tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody td {
    padding: 12px;
    vertical-align: top;
}

.guardrail-text {
    max-width: 300px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.actions {
    white-space: nowrap;
    text-align: center;
}

/* Checkbox Styling */
.actions input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #27ae60;
    transform: scale(1.1);
}

.actions input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Style for the batch insert button in header */
.batch-header {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.batch-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #27ae60;
    margin: 0;
    transform: scale(1.1);
}

#batchInsertBtn {
    white-space: nowrap;
    min-width: 120px;
    font-size: 12px;
    padding: 12px 16px; /* Increased padding by 8px (was 4px 8px) */
}

/* Special styling for batch insert button */
.btn-batch {
    background-color: #27ae60;
    color: white;
}

.btn-batch:hover:not(:disabled) {
    background-color: #219a52;
}

.btn-batch:disabled {
    background-color: white !important;
    color: #2c3e50 !important;
    border: 2px solid #2c3e50;
    cursor: not-allowed;
    opacity: 1; /* Override the general disabled opacity */
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #eee;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    color: #2c3e50;
    font-size: 1.5rem;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

/* Forms */
form {
    padding: 20px;
}

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

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

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

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

/* Messages */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    font-weight: 500;
    z-index: 1001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.message.show {
    transform: translateX(0);
}

.message.success {
    background-color: #27ae60;
    color: white;
}

.message.error {
    background-color: #e74c3c;
    color: white;
}

/* Loading and No Data */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #666;
}

.no-data {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.no-data p {
    color: #666;
    font-size: 16px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .header-left, .header-right {
        flex: none;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 0;
    }
    
    .filter-group {
        min-width: unset;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .guardrail-text {
        max-width: 200px;
    }
    
    /* Mobile checkbox adjustments */
    .actions input[type="checkbox"] {
        width: 16px;
        height: 16px;
        transform: scale(1);
    }
    
    #batchInsertBtn {
        font-size: 11px;
        padding: 8px 12px; /* Adjusted for mobile but still bigger than before */
        min-width: 100px;
    }
    
    .batch-header {
        flex-direction: column;
        gap: 4px;
    }
    
    .batch-header input[type="checkbox"] {
        width: 16px;
        height: 16px;
        transform: scale(1);
    }
}