* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f6fa;
    color: #2c3e50;
    line-height: 1.6;
}

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

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-left {
    text-align: left;
}

.header-right {
    display: flex;
    align-items: center;
}

/* Database Status Styles */
#database-indicator {
    background: rgba(52, 152, 219, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

#db-uri {
    background: rgba(44, 62, 80, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    max-width: 450px;
    transition: all 0.3s ease;
}

#db-uri:hover {
    background: rgba(44, 62, 80, 0.1);
    max-width: none;
}

.environment-toggle {
    display: flex;
    align-items: center;
}

.env-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.env-toggle-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.env-toggle-btn.production {
    background: #e74c3c;
}

.env-toggle-btn.production:hover {
    background: #c0392b;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 2rem;
}

header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.tabs {
    display: flex;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: white;
    color: #7f8c8d;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background: #f8f9fa;
    color: #2c3e50;
}

.tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: #f8f9fa;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section {
    background: white;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.3rem;
}

form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

input[type="text"],
select,
textarea {
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    flex: 1;
    min-width: 200px;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
}

textarea {
    min-width: 100%;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    resize: vertical;
}

button {
    padding: 12px 24px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    height: 44px;
    min-height: 44px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background: #2980b9;
}

.refresh-btn {
    background: #27ae60;
    margin-bottom: 15px;
}

.refresh-btn:hover {
    background: #229954;
}

.test-btn {
    background: #e67e22;
    min-width: 160px;
}

.test-btn:hover {
    background: #d35400;
}

.item {
    padding: 15px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #fafbfc;
}

.item strong {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-size: 1.1rem;
}

.item .id {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #f1f3f4;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #5d4037;
}

.item .meta {
    margin-top: 8px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.item .link {
    display: inline-block;
    margin-top: 8px;
    color: #3498db;
    text-decoration: none;
    font-size: 0.9rem;
}

.item .link:hover {
    text-decoration: underline;
}

.no-data {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 20px;
}

#status-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    font-weight: 500;
    z-index: 1000;
    max-width: 400px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

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

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

.status.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.post-item {
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    margin-bottom: 20px;
    overflow: hidden;
}

.post-item h4 {
    background: #f8f9fa;
    padding: 12px 15px;
    margin: 0;
    color: #2c3e50;
    border-bottom: 1px solid #e1e8ed;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
}

.post-content {
    padding: 15px;
    white-space: pre-wrap;
    line-height: 1.6;
    background: white;
}

.browser-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e8ed;
}

.browser-btn {
    padding: 8px 16px;
    background: #f8f9fa;
    color: #7f8c8d;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.browser-btn:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.browser-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.browser-content {
    display: none;
}

.browser-content.active {
    display: block;
}

.browser-content h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.file-item {
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    margin-bottom: 15px;
    background: #fafbfc;
}

.file-header {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    border-bottom: 1px solid #e1e8ed;
}

.file-header strong {
    flex: 1;
    color: #2c3e50;
}

.file-size,
.file-modified {
    font-size: 0.85rem;
    color: #7f8c8d;
    background: #f1f3f4;
    padding: 2px 8px;
    border-radius: 3px;
}

.file-actions {
    padding: 8px 15px;
    display: flex;
    gap: 8px;
}

.view-btn,
.download-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
}

.view-btn {
    background: #e74c3c;
    color: white;
}

.view-btn:hover {
    background: #c0392b;
}

.download-btn {
    background: #f39c12;
    color: white;
}

.download-btn:hover {
    background: #e67e22;
}

.file-content {
    padding: 15px;
    background: white;
    border-top: 1px solid #e1e8ed;
}

.file-content pre {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.upload-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e1e8ed;
}

.upload-section h4 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.file-upload {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.file-upload input[type="file"] {
    flex: 1;
    padding: 8px;
    border: 2px dashed #e1e8ed;
    border-radius: 6px;
    background: #fafbfc;
}

.context-editor {
    margin-top: 15px;
}

.context-editor textarea {
    min-height: 150px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    margin-bottom: 10px;
}

.filter-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-row .refresh-btn {
    align-self: flex-start;
    /* Position at the same level as the select element */
    margin-top: 32px; /* Approximate height of label + gap to align with select */
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    flex: 1;
}

.filter-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.filter-group select {
    margin: 0;
    min-width: 200px;
}

.context-display {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
}

.context-display h4 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.context-display pre {
    background: white;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #e1e8ed;
}

.context-section {
    margin-bottom: 15px;
    padding: 12px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e1e8ed;
}

.context-section h5 {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 0.9rem;
    font-weight: 600;
}

.context-section pre {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    margin: 0;
    border: 1px solid #e9ecef;
}

.agent-details {
    margin-top: 15px;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 6px;
    border: 1px solid #bbdefb;
}

.agent-details h4 {
    margin-bottom: 12px;
    color: #1565c0;
    font-size: 1.1rem;
}

.agent-info p {
    margin-bottom: 6px;
    color: #2c3e50;
    font-size: 0.9rem;
}

.agent-info strong {
    color: #1565c0;
    font-weight: 600;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .browser-nav {
        flex-wrap: wrap;
    }
    
    form {
        flex-direction: column;
    }
    
    input[type="text"],
    select,
    button {
        width: 100%;
        min-width: unset;
    }
    
    .file-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .file-actions {
        flex-wrap: wrap;
    }
    
    .file-upload {
        flex-direction: column;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-row .refresh-btn {
        margin-top: 10px;
    }
    
    .filter-group {
        min-width: unset;
        width: 100%;
    }
    
    .filter-group select {
        min-width: unset;
        width: 100%;
    }
}

/* Agent Main Tabs */
.agent-main-tabs {
    display: flex;
    background: white;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 0;
}

.agent-main-tab-button {
    flex: 1;
    padding: 15px 20px;
    background: #f8f9fa;
    color: #7f8c8d;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.agent-main-tab-button:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.agent-main-tab-button.active {
    background: white;
    color: #2c3e50;
    border-bottom-color: #e74c3c;
    font-weight: 600;
}

.agent-main-tab-content {
    display: none;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 25px;
}

.agent-main-tab-content.active {
    display: block;
}

.agent-form-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f3f4;
}

.agent-basic-form {
    margin-top: 15px;
}

.form-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

/* Agent Configuration Container */
.agent-config-container {
    margin-top: 0;
    width: 100%;
}

/* Configuration Tabs */
.config-tab-nav {
    display: flex;
    background: white;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.config-tab-button {
    flex: 1;
    padding: 15px 20px;
    background: #f8f9fa;
    color: #7f8c8d;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.config-tab-button:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.config-tab-button.active {
    background: white;
    color: #2c3e50;
    border-bottom-color: #3498db;
    font-weight: 600;
}

.config-tab-content {
    display: none;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 25px;
    min-height: 400px;
}

.config-tab-content.active {
    display: block;
}

/* Context Panel */
.context-section {
    margin-bottom: 15px;
}

.context-section label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.context-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.context-content textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: vertical;
}

/* Execution Plan Panel */
.execution-plan-section {
    margin-bottom: 15px;
}

.execution-plan-section label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.execution-config {
    margin-bottom: 20px;
}

.execution-config label {
    display: block;
    font-weight: 500;
    color: #2c3e50;
    margin: 15px 0 8px 0;
    font-size: 0.9rem;
}

.execution-config input[type="time"] {
    width: 150px;
    padding: 8px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    font-size: 0.9rem;
}

.custom-schedule-entry {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
}

.custom-schedule-entry select {
    flex: 1;
    margin: 0;
}

.custom-schedule-entry input[type="time"] {
    width: 120px;
}

.execution-plan-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Button Styles */
.read-btn {
    background: #17a2b8;
    color: white;
}

.read-btn:hover {
    background: #138496;
}

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

.update-btn:hover {
    background: #218838;
}

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

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

.add-btn {
    background: #007bff;
    color: white;
    padding: 8px 16px;
    font-size: 0.85rem;
}

.add-btn:hover {
    background: #0056b3;
}

.remove-btn {
    background: #dc3545;
    color: white;
    padding: 4px 8px;
    font-size: 0.8rem;
    min-width: auto;
}

.remove-btn:hover {
    background: #c82333;
}

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

.create-btn:hover {
    background: #218838;
}

/* Current Display Areas */
#current-context-display,
#current-execution-plan-display {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
}

#current-context-display h4,
#current-execution-plan-display h4 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 0.95rem;
}

#current-context-display pre,
#current-execution-plan-display pre {
    background: white;
    padding: 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #e1e8ed;
    margin: 0;
}

.plan-summary {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
}

.plan-summary p {
    margin: 8px 0;
    color: #2c3e50;
    font-size: 0.9rem;
}

.plan-summary strong {
    color: #1565c0;
    font-weight: 600;
}

.schedule-list {
    margin: 8px 0 0 20px;
    padding: 0;
}

.schedule-list li {
    margin: 4px 0;
    color: #2c3e50;
    font-size: 0.9rem;
}

/* Responsive Design for Configuration Tabs */
@media (max-width: 768px) {
    .config-tab-button {
        font-size: 0.9rem;
        padding: 12px 15px;
    }
    
    .config-tab-content {
        padding: 20px 15px;
        min-height: 300px;
    }
    
    .context-actions,
    .execution-plan-actions {
        flex-direction: column;
    }
    
    .custom-schedule-entry {
        flex-direction: column;
        align-items: stretch;
    }
    
    .custom-schedule-entry input[type="time"] {
        width: 100%;
    }
}

/* Weekday selector styling */
.weekday-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.weekday-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.weekday-selector label:hover {
    background-color: #f0f0f0;
}

.weekday-selector input[type="checkbox"]:checked + span {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

/* Alert styling */
.alert-info, .alert-warning {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 14px;
}

.alert-info {
    background-color: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #2196f3;
}

.alert-warning {
    background-color: #fff3e0;
    color: #e65100;
    border: 1px solid #ff9800;
}

/* Context tabs for Test/Social Media Post section */
.context-tab-nav {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid #e9ecef;
}

.context-tab-btn {
    padding: 8px 16px;
    border: none;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.context-tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.context-tab-btn.active {
    background: #3498db;
    color: white;
    font-weight: 500;
}

.context-tab-content {
    display: none;
    padding: 15px 0;
}

.context-tab-content.active {
    display: block;
}

/* Spinner Animation */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}