/* Admin Layout */
:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --sidebar-width: 260px;
    --sidebar-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
}

/* Admin Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    padding: 20px 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.sidebar-brand h4 {
    color: #fff;
    margin: 0;
    font-weight: 600;
    font-size: 1.25rem;
}

.sidebar-brand small {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

.sidebar .nav {
    flex: 1;
}

.sidebar .nav-item {
    margin: 2px 10px;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 12px 15px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.sidebar .nav-link i {
    margin-right: 10px;
    width: 20px;
    font-size: 1.1rem;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 24px 30px;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Stats Cards */
.stats-card {
    border-radius: 12px;
    padding: 20px;
    color: white;
    height: 100%;
}

.stats-card.green {
    background: linear-gradient(135deg, #4CAF50 0%, #66bb6a 100%);
}

.stats-card.blue {
    background: linear-gradient(135deg, #1976d2 0%, #42a5f5 100%);
}

.stats-card.orange {
    background: linear-gradient(135deg, #f57c00 0%, #ffb74d 100%);
}

.stats-card.purple {
    background: linear-gradient(135deg, #7b1fa2 0%, #ba68c8 100%);
}

.stats-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.stats-card small {
    opacity: 0.9;
}

.stats-card i {
    font-size: 2.5rem;
    opacity: 0.5;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: #666;
    border-top: none;
    background: #f8f9fa;
    padding: 12px 16px;
}

.table td {
    padding: 12px 16px;
    vertical-align: middle;
}

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

/* Badges */
.badge-active {
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.badge-inactive {
    background-color: #ffebee;
    color: #c62828;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.badge-method {
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
}

.badge-method.get {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-method.post {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-method.put {
    background: #fff3e0;
    color: #ef6c00;
}

.badge-method.delete {
    background: #ffebee;
    color: #c62828;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Forms */
.form-label {
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border-radius: 8px;
    padding: 10px 14px;
    border: 1px solid #ddd;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* JSON Editor */
.json-editor {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    min-height: 200px;
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 8px;
    padding: 12px;
}

/* Modals */
.modal-header {
    border-bottom: 1px solid #eee;
    padding: 16px 20px;
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid #eee;
    padding: 16px 20px;
}

/* Blazor Built-in Reconnection Modal Styling */
#components-reconnect-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

#components-reconnect-modal > div {
    background: white;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

/* Toast Notifications */
.toast {
    min-width: 300px;
}

/* Action Buttons */
.btn-action {
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    transform: translateY(-1px);
}

.btn-action.edit {
    background: #e3f2fd;
    color: #1976d2;
}

.btn-action.edit:hover {
    background: #bbdefb;
}

.btn-action.delete {
    background: #ffebee;
    color: #c62828;
}

.btn-action.delete:hover {
    background: #ffcdd2;
}

/* App Selector */
.app-selector {
    min-width: 220px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h5 {
    color: #666;
    margin-bottom: 8px;
}

.empty-state p {
    margin-bottom: 20px;
}

/* Page Editor Specific */
.editor-container {
    display: flex;
    height: calc(100vh - 80px);
    margin: -24px -30px;
}

.component-palette {
    width: 280px;
    background: white;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    flex-shrink: 0;
}

.palette-section {
    border-bottom: 1px solid #eee;
}

.palette-section-header {
    padding: 12px 16px;
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    background: #f8f9fa;
    cursor: pointer;
}

.palette-items {
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.palette-item {
    padding: 12px 8px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: grab;
    text-align: center;
    transition: all 0.2s;
    font-size: 12px;
}

.palette-item:hover {
    background: #e3f2fd;
    border-color: #2196F3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.palette-item i {
    font-size: 24px;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.palette-item:hover i {
    color: #2196F3;
}

.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f0f2f5;
}

.properties-panel {
    width: 320px;
    background: white;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.properties-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.properties-header h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.property-group {
    padding: 16px;
    border-bottom: 1px solid #eee;
}

.property-group-title {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 12px;
}

.property-field {
    margin-bottom: 12px;
}

.property-field label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.property-field input,
.property-field select,
.property-field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

/* Tree View */
.tree-view {
    padding: 16px;
}

.tree-node {
    margin-left: 0;
}

.tree-node-content {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid transparent;
}

.tree-node-content:hover {
    background: #f0f0f0;
}

.tree-node-content.selected {
    background: #e3f2fd;
    border-color: #2196F3;
}

.tree-node-content i {
    margin-right: 8px;
    color: #666;
}

.tree-node-content .node-type {
    font-weight: 500;
    flex: 1;
}

.tree-node-content .node-info {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
}

.tree-children {
    margin-left: 24px;
    border-left: 1px dashed #ddd;
    padding-left: 8px;
}

/* Responsive */
@media (max-width: 1200px) {
    .sidebar {
        width: 70px;
    }

    .sidebar-brand h4,
    .sidebar-brand small,
    .sidebar .nav-link span,
    .sidebar-footer {
        display: none;
    }

    .sidebar .nav-link {
        justify-content: center;
        padding: 12px;
    }

    .sidebar .nav-link i {
        margin: 0;
        font-size: 1.3rem;
    }

    .main-content {
        margin-left: 70px;
        width: calc(100% - 70px);
    }
}
