/* General & Layout */
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; margin: 0; background-color: #f4f7f6; color: #333; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.container { display: flex; flex-grow: 1; width: 100%; overflow: hidden; }
.sidebar { width: 320px; min-width: 300px; background-color: #2c3e50; color: #ecf0f1; padding: 20px; box-shadow: 2px 0 5px rgba(0,0,0,0.1); overflow-y: auto; height: 100%; display: flex; flex-direction: column; }
.sidebar h1 { font-size: 1.5em; text-align: center; margin-bottom: 5px; color: #fff; }
.content { flex-grow: 1; padding: 25px; overflow-y: auto; height: 100%; }
#loggingContainer { height: 400px; min-height: 250px; border-top: 2px solid #ccc; background-color: #e9ecef; overflow-y: hidden; display: grid; grid-template-columns: 1fr; gap: 10px; padding: 10px; }

/* Version Display */
.app-version { text-align: center; font-size: 0.8em; color: #95a5a6; margin-bottom: 20px; }

/* Main Navigation */
.main-nav a { display: block; color: #ecf0f1; text-decoration: none; padding: 12px 15px; margin-bottom: 5px; border-radius: 4px; transition: background-color 0.3s ease; font-weight: 600; }
.main-nav a:hover { background-color: #34495e; }
.main-nav a.active { background-color: #3498db; color: white; }

/* Sidebar Sections */
.sidebar-section { border-top: 1px solid #34495e; padding-top: 20px; margin-top: 20px; }
.sidebar-section h2 { font-size: 1.2em; margin-top: 0; color: #1abc9c; border-bottom: 1px solid #34495e; padding-bottom: 10px; }
.auth-item { margin-bottom: 15px; }
.auth-item label { display: block; margin-bottom: 5px; font-size: 0.9em; font-weight: 600; }
.auth-item input[type="text"], .sidebar-section textarea { width: 100%; padding: 10px; border-radius: 4px; border: 1px solid #7f8c8d; background-color: #34495e; color: #ecf0f1; box-sizing: border-box; font-family: 'Courier New', Courier, monospace; }

/* Main Content Sections */
.page-section { margin-bottom: 30px; padding: 25px; background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.page-section h3 { font-size: 1.5em; color: #2c3e50; margin-top: 0; padding-bottom: 10px; border-bottom: 2px solid #eaecee; }

.page-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px; /* Add spacing between grid items */
}

.api-action { margin-top: 25px; padding-top: 20px; border-top: 1px dashed #bdc3c7; }
.api-action:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.api-action h4 { margin-top: 0; margin-bottom: 15px; font-size: 1.2em; color: #34495e; }
.api-action label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.9em; color: #555; }
.api-action input[type="text"], .api-action input[type="number"], .api-action textarea.json-payload { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #bdc3c7; border-radius: 4px; font-family: 'Courier New', Courier, monospace; font-size: 0.9em; box-sizing: border-box; }
.api-action textarea.json-payload { min-height: 120px; resize: vertical; }
.api-action button { background-color: #3498db; color: white; padding: 10px 18px; border: none; border-radius: 4px; cursor: pointer; transition: background-color 0.2s ease; font-size: 0.95em; margin-top: 10px; }
.api-action button.small-btn { padding: 5px 10px; font-size: 0.8em; }
.api-action button:hover { background-color: #2980b9; }
.param-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.response-area { display: none; background-color: #f8f9fa; border: 1px solid #dee2e6; color: #212529; padding: 15px; border-radius: 4px; margin-top: 15px; white-space: pre-wrap; word-wrap: break-word; font-family: 'Courier New', Courier, monospace; font-size: 0.9em; min-height: 40px; }
.response-area:not(:empty) { display: block; }

.json-payload {
    width: 100%;
    min-height: 150px;
    font-family: 'Courier New', Courier, monospace;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    color: #333;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
}

.api-links { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px dashed #bdc3c7; font-size: 0.9em; }
.api-links a { text-decoration: none; color: #3498db; }
.api-links a:hover { text-decoration: underline; }

/* Table / Grid Styles */
.results-grid, #monitor-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.results-grid th, .results-grid td, #monitor-table th, #monitor-table td {
    border: 1px solid #dfe6e9;
    padding: 8px 12px;
    text-align: left;
    font-size: 0.9em;
}
.results-grid th, #monitor-table th {
    background-color: #f4f7f6;
    font-weight: 600;
}
.results-grid tbody tr:nth-child(even), #monitor-table tbody tr:nth-child(even) {
    background-color: #fbfcfc;
}

.results-grid tbody tr:hover {
    background-color: #f0f4f8;
    cursor: pointer;
}

/* Specific rule for narrower rows in certain tables */
.results-grid.compact-rows td {
    padding: 4px 12px;
}

/* Make buttons inside compact rows smaller to fit */
.compact-rows .btn {
    padding: 2px 8px;
    font-size: 0.8em;
}

/* Logging Area */
.log-panel { height: 100%; display: flex; flex-direction: column; overflow: auto; background: #fff; border: 1px solid #ccc; border-radius: 4px; padding: 10px;}
.log-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding-bottom: 5px; border-bottom: 1px solid #eee;}
.log-header h2 { margin: 0; font-size: 1.1em; color: #333; }
.log-header button { background-color: #95a5a6; padding: 4px 8px; font-size: 0.8em; }
.log-header button:hover { background-color: #7f8c8d; }
.log-area.general-log { background-color: #2b3e50; color: #e0e9f0; padding: 15px; border-radius: 4px; flex-grow: 1; overflow-y: auto; border: 1px solid #4a6572; }
.log-entry span { font-weight: bold; margin-right: 5px; }
.log-ui { color: #1abc9c; }
.log-ocpi { color: #2ecc71; }
.log-error { color: #e74c3c; }
.log-internal-api { color: #3498db; }

/* Kafka Viewer Panel */
.kafka-viewer-container { display: flex; height: 100%; flex-grow: 1; overflow: hidden; }
.topic-list-pane { width: 40%; min-width: 200px; border-right: 1px solid #eaecee; padding: 0; overflow-y: auto; }
.message-view-pane { flex-grow: 1; padding: 0 0 0 10px; overflow-y: auto; display: flex; flex-direction: column; }
#kafka-topic-list { list-style-type: none; padding: 0; margin: 0; }
#kafka-topic-list li { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; font-size: 0.9em; }
#kafka-topic-list li:hover { background-color: #f8f9fa; }
#kafka-topic-list li.active { background-color: #e0eafc; font-weight: 600; }
.message-count-badge { background-color: #3498db; color: white; padding: 2px 8px; border-radius: 10px; font-size: 0.8em; }
#message-display-area, #dlq-message-area { background-color: #2c3e50; color: #ecf0f1; border-radius: 4px; padding: 15px; white-space: pre-wrap; word-break: break-all; flex-grow: 1; font-size: 0.85em; overflow-y: auto; }
#message-view-header { margin: 0 0 10px 0; font-size: 1em;}

/* Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5); 
}

.modal-content {
    background-color: #fefefe;
    margin: 5vh auto; 
    padding: 20px;
    border: 1px solid #888;
    width: 80%; 
    max-width: 500px; /* Smaller modal for forms */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
  
/* Hardware Page Specific Styles */  
.form-section {
    margin-top: 20px;
    padding: 0; /* Remove padding as it's in the modal now */
    background-color: transparent;
    border: none;
}

.form-section h4 {
    margin-top: 0;
    color: #34495e;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px; /* More space in forms */
}

.form-grid input,
.form-grid select {
    width: 100%;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    box-sizing: border-box;
}

.form-grid button {
    background-color: #27ae60;
    color: white;
    padding: 12px 18px; /* Larger button */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 1em;
    justify-self: start;
}

.form-grid button:hover {
    background-color: #229954;
}

.results-grid .delete-btn {
    background-color: #e74c3c;
}

.results-grid .delete-btn:hover {
    background-color: #c0392b;
}

/* General Button Styles */
.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.9em;
    font-weight: 600;
    color: white;
    text-align: center;
    vertical-align: middle;
    box-sizing: border-box;
    margin: 0 2px;
}

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

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-edit {
    background-color: #27ae60; /* Green for edit */
}

.btn-edit:hover {
    background-color: #229954;
}

.api-action .red-btn {
    background-color: #e74c3c;
}

.api-action .red-btn:hover {
    background-color: #c0392b;
}

.api-action .green-btn {
    background-color: #27ae60;
}

.api-action .green-btn:hover {
    background-color: #229954;
}

/* Update delete button to use base class */
.delete-btn {
    background-color: #e74c3c;
}

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

/* Style for header buttons */
.header-with-button {
    display: flex;
    justify-content: flex-start; /* Align items to the start */
    align-items: center;
    gap: 15px; /* Add space between heading and button */
    margin-bottom: 15px;
}

.header-with-button h4 {
    margin: 0;
}

/* General Select Style */
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: white;
    font-size: 0.9em;
    margin-bottom: 15px; /* Add some space below the main select */
}


/* General Button Styles */
.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.9em;
    font-weight: 600;
    color: white;
    text-align: center;
    vertical-align: middle;
}

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

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-edit {
    background-color: #27ae60; /* Green for edit */
}

.btn-edit:hover {
    background-color: #229954;
}

/* Update delete button to use base class */
.delete-btn {
    background-color: #e74c3c;
}

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

/* Style for header buttons */
.header-with-button {
    display: flex;
    justify-content: flex-start; /* Align items to the start */
    align-items: center;
    gap: 15px; /* Add space between heading and button */
    margin-bottom: 15px;
}

.header-with-button h4 {
    margin: 0;
}

/* General Select Style */
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: white;
    font-size: 0.9em;
    margin-bottom: 15px; /* Add some space below the main select */
}

