/* Decision Control Environments - Clean Sidebar Design */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #ffffff;
    border-right: 1px solid #e1e4e8;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid #e1e4e8;
}

.sidebar .logo {
    height: 32px;
    width: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #f5f7fa;
    color: #0066cc;
}

.nav-item.active {
    background: #e8f2ff;
    color: #0066cc;
    border-left-color: #0066cc;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #e1e4e8;
}

.user-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.sign-out-btn {
    width: 100%;
    padding: 8px 12px;
    background: white;
    border: 1px solid #dc3545;
    color: #dc3545;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.sign-out-btn:hover {
    background: #dc3545;
    color: white;
}

/* Main Content */
.main-content {
    margin-left: 220px;
    flex: 1;
    padding: 40px;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    color: #666;
}

/* Status Badges */
.status-badges {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.offline {
    background: #ffe4e6;
    color: #dc3545;
}

.status-badge.online {
    background: #d4edda;
    color: #28a745;
}

/* Environment Grid */
.environment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* Environment Cards */
.env-card {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 24px;
    transition: all 0.3s;
}

.env-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

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

.env-name {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
}

.env-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.env-badge.dev {
    background: #d4e8ff;
    color: #0066cc;
}

.env-badge.test {
    background: #d4edda;
    color: #28a745;
}

.env-badge.prod {
    background: #ffe4e6;
    color: #dc3545;
}

.env-badge.new {
    background: #e9d5ff;
    color: #8b5cf6;
}

.env-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    min-height: 40px;
}

/* Environment Stats */
.env-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
}

/* Launch Button */
.launch-btn {
    width: 100%;
    padding: 12px 20px;
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.launch-btn:hover {
    background: #0052a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.3);
}

.launch-btn:active {
    transform: translateY(0);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px;
    color: #666;
}

.loading::after {
    content: "Loading...";
    display: block;
    margin-top: 16px;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
        padding: 20px;
    }

    .environment-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .sidebar {
        width: 100%;
        position: relative;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-footer {
        display: none;
    }
}

/* Content Views */
.content-view {
    display: none;
}

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

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

/* Unit Card */
.unit-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.2s;
}

.unit-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.unit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.unit-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.unit-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.unit-status.enabled {
    background: #d4edda;
    color: #155724;
}

.unit-status.disabled {
    background: #f8d7da;
    color: #721c24;
}

.unit-versions {
    display: none;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e1e4e8;
}

.unit-card.expanded .unit-versions {
    display: block;
}

.version-item {
    padding: 12px;
    margin: 8px 0;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.version-item:hover {
    background: #e9ecef;
}

.version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.version-name {
    font-weight: 600;
    color: #495057;
}

.version-models {
    display: none;
    margin-top: 10px;
    padding-left: 20px;
}

.version-item.expanded .version-models {
    display: block;
}

.model-item {
    padding: 8px 12px;
    margin: 4px 0;
    background: white;
    border-left: 3px solid #0066CC;
    border-radius: 4px;
    font-size: 14px;
}

.model-name {
    font-weight: 500;
    color: #333;
}

.model-meta {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.expand-icon {
    transition: transform 0.2s;
}

.expanded .expand-icon {
    transform: rotate(90deg);
}

/* Disabled button state */
.launch-btn.disabled,
.launch-btn:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.launch-btn.disabled:hover,
.launch-btn:disabled:hover {
    background: #e9ecef;
    transform: none;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f7fa;
    color: #333;
}

.modal-body {
    padding: 24px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #0066CC;
}

.form-control[readonly] {
    background: #f8f9fa;
    color: #666;
}

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

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e1e4e8;
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #0066CC;
    color: white;
}

.btn-primary:hover {
    background: #0052a3;
}

.btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.btn-secondary:hover {
    background: #dee2e6;
}

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

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

.btn-danger {
    background: #dc3545;
    color: white;
}

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

/* Submit button for models */
.model-submit-btn {
    margin-top: 8px;
    padding: 6px 12px;
    background: #0066CC;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.model-submit-btn:hover {
    background: #0052a3;
}

/* Task Cards */
.task-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.task-header h3 {
    margin: 0 0 4px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

/* Status Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-approved {
    background: #d4edda;
    color: #155724;
}

.status-deployed {
    background: #d1ecf1;
    color: #0c5460;
}

.status-rejected {
    background: #f8d7da;
    color: #721c24;
}
