/* ==============================================
   ACSI Server - IEC 61850 Server Page Styles
   ============================================== */

.acsi-server-page {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.acsi-server-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.acsi-server-page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.acsi-page-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(14, 165, 233, 0.45);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.acsi-server-subtitle {
    color: var(--text-muted);
    margin-bottom: 22px;
}

.acsi-server-layout {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 20px;
}

.acsi-panel {
    grid-column: span 4;
    background: linear-gradient(165deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.85));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.acsi-panel-primary {
    grid-column: span 8;
}

.acsi-panel-main {
    grid-column: 1 / span 12;
}

.acsi-panel-main-half {
    grid-column: span 4;
}

.acsi-panel-sidebar {
    grid-column: 9 / span 4;
}

.acsi-panel h2 {
    font-size: 16px;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.acsi-endpoint-card {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(71, 85, 105, 0.45);
    border-radius: 10px;
    padding: 14px;
    overflow-x: auto;
}

.acsi-endpoint-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 18px;
    min-width: max-content;
}

.acsi-endpoint-item {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}

.acsi-endpoint-status-row {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(71, 85, 105, 0.35);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.acsi-endpoint-status-text {
    color: var(--text-secondary);
    font-size: 13px;
}

.acsi-endpoint-line {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(71, 85, 105, 0.35);
}

.acsi-endpoint-line:last-child {
    border-bottom: 0;
}

.acsi-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.acsi-value {
    color: var(--text-primary);
    font-size: 14px;
    white-space: nowrap;
}

.acsi-status {
    text-transform: capitalize;
}

.acsi-feature-list {
    list-style: none;
    display: grid;
    gap: 10px;
}

.acsi-feature-list li {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(71, 85, 105, 0.45);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text-secondary);
}

.acsi-api-controls {
    display: grid;
    gap: 10px;
}

.acsi-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.acsi-actions-row .btn-primary {
    min-width: 120px;
    justify-content: center;
}

.acsi-select,
.acsi-textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 14px;
}

.acsi-select:focus,
.acsi-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.acsi-textarea {
    resize: vertical;
    min-height: 120px;
    font-family: Consolas, 'Courier New', monospace;
}

#acsi-api-run {
    justify-content: center;
}

.acsi-log-tabs {
    display: inline-flex;
    gap: 8px;
    margin-bottom: 12px;
}

.acsi-log-tab {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
}

.acsi-log-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.acsi-log-tab-panel {
    display: none;
}

.acsi-log-tab-panel.active {
    display: block;
}

.acsi-log-list {
    max-height: 520px;
    overflow-y: auto;
    display: grid;
    gap: 10px;
}

.acsi-model-tree {
    margin-top: 8px;
    min-height: 360px;
    max-height: 520px;
    border-radius: 10px;
    border: 1px solid rgba(71, 85, 105, 0.45);
    background: rgba(15, 23, 42, 0.45);
    padding: 12px;
    overflow: auto;
}

.acsi-model-state {
    color: var(--text-muted);
    font-size: 13px;
}

.acsi-model-error {
    color: var(--danger-color);
}

.acsi-model-json {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    white-space: pre;
    font-family: Consolas, 'Courier New', monospace;
}

.acsi-log-empty {
    min-height: 120px;
    border-radius: 10px;
    border: 1px dashed var(--border-light);
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px;
}

.acsi-log-item {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(71, 85, 105, 0.45);
    border-left-width: 4px;
    border-radius: 10px;
    padding: 10px 12px;
}

.acsi-log-info {
    border-left-color: var(--info-color);
}

.acsi-log-success {
    border-left-color: var(--success-color);
}

.acsi-log-error {
    border-left-color: var(--danger-color);
}

.acsi-log-head {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.acsi-log-time {
    font-size: 12px;
    color: var(--text-muted);
}

.acsi-log-message {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.acsi-log-details {
    margin: 0;
    padding: 10px;
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.75);
    border: 1px solid rgba(71, 85, 105, 0.45);
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    max-height: 220px;
    overflow-y: auto;
}

#acsi-modelPanel .scl-da-clickable {
    cursor: pointer;
}

#acsi-modelPanel .scl-da-clickable:hover {
    background: rgba(30, 64, 175, 0.15);
    border-radius: 8px;
}

.acsi-da-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
}

.acsi-da-modal[hidden] {
    display: none !important;
}

.acsi-da-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.65);
}

.acsi-da-modal-dialog {
    position: relative;
    width: min(680px, 92vw);
    max-height: 86vh;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: linear-gradient(165deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    box-shadow: var(--shadow-lg);
    padding: 16px;
}

.acsi-da-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.acsi-da-modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
}

.acsi-da-modal-body {
    display: grid;
    gap: 10px;
}

.acsi-empty-state {
    min-height: 160px;
    border-radius: 10px;
    border: 1px dashed var(--border-light);
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px;
}

@media (max-width: 1200px) {
    .acsi-panel,
    .acsi-panel-primary,
    .acsi-panel-main,
    .acsi-panel-main-half,
    .acsi-panel-sidebar {
        grid-column: span 12;
    }
}
