/* ============================================
   Archi-BioFoam 0.2 - CSS Stylesheet
   ============================================ */

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

:root {
    --primary-color: #1e3a8a;
    --secondary-color: #3b82f6;
    --accent-color: #60a5fa;
    --text-dark: #1f2937;
    --text-medium: #4b5563;
    --text-light: #6b7280;
    --bg-white: #ffffff;
    --bg-gray: #f9fafb;
    --border-light: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gray);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   Dashboard Layout - Two Panel Design
   ============================================ */
.dashboard-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    padding: 24px;
    min-height: calc(100vh - 80px);
}

.left-panel {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 24px;
    height: fit-content;
    position: sticky;
    top: 90px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border-light);
}

.right-panel {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border-light);
    min-height: 600px;
}

/* User Info Card */
.user-info-card {
    text-align: center;
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    margin: 0 auto 16px;
}

.user-info-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.user-role {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.nav-item {
    padding: 12px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-medium);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-item:hover {
    background: var(--bg-gray);
    color: var(--primary-color);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

/* Current State Display */
.current-state {
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.current-state h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

#current-sim-state {
    font-size: 13px;
    color: var(--text-medium);
    padding: 12px;
    background: var(--bg-gray);
    border-radius: 6px;
}

/* ============================================
   Header
   ============================================ */
header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    height: 45px;
    width: auto;
}

header h1 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-dark);
    letter-spacing: -0.3px;
}

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

/* ============================================
   Wizard Container
   ============================================ */
#wizard-container {
    min-height: 400px;
}

.wizard-step {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wizard-step h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

/* Wizard Navigation */
.wizard-navigation {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* Radio Options */
.radio-option {
    display: block;
    padding: 16px;
    margin-bottom: 12px;
    border: 2px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: var(--accent-color);
    background: var(--bg-gray);
}

.radio-option input[type="radio"] {
    margin-right: 12px;
}

.radio-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--primary-color);
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

/* ============================================
   Form Styling
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text-dark);
}

input:hover, select:hover, textarea:hover {
    border-color: var(--accent-color);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234b5563' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

.form-group small {
    color: var(--text-light);
    font-size: 12px;
    margin-top: 6px;
    display: block;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
}

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

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-gray);
    border-color: var(--text-medium);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ============================================
   Simulations Table
   ============================================ */
.tasks-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.tasks-table thead {
    background: var(--bg-gray);
}

.tasks-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-light);
}

.tasks-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-light);
}

.tasks-table tr:hover {
    background: var(--bg-gray);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status-badge.pending {
    background: rgba(59, 130, 246, 0.1);
    color: var(--secondary-color);
}

.status-badge.running {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-badge.completed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Progress Bar */
.progress-bar {
    width: 100px;
    height: 6px;
    background: var(--bg-gray);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.5s ease;
    border-radius: 3px;
}

.running .progress-fill {
    background: var(--warning);
}

.completed .progress-fill {
    background: var(--success);
}

.failed .progress-fill {
    background: var(--danger);
}

/* ============================================
   Login Page
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 48px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid var(--border-light);
    max-width: 420px;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    color: var(--text-medium);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .left-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .dashboard-layout {
        padding: 12px;
        gap: 12px;
    }

    .right-panel {
        padding: 20px;
    }

    .wizard-navigation {
        flex-direction: column;
    }
}

/* ============================================
   Visualization Page Layout
   ============================================ */
.visualization-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    height: 100vh;
    gap: 0;
    background: var(--bg-gray);
}

.viz-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.viz-content {
    grid-column: 1;
    grid-row: 2;
    background: #f0f0f0;
    overflow: hidden;
    position: relative;
}

#trame-viewer {
    width: 100%;
    height: 100%;
}

.viz-info {
    grid-column: 2;
    grid-row: 2;
    background: white;
    padding: 20px;
    overflow-y: auto;
    border-left: 1px solid var(--border-light);
}

.viz-info h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 600;
}

.viz-info dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: 13px;
}

.viz-info dt {
    font-weight: 600;
    color: var(--text-light);
}

.viz-info dd {
    margin: 0;
    color: var(--text-dark);
}

/* Error container for visualization errors */
.error-container {
    max-width: 600px;
    margin: 100px auto;
    padding: 48px;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid var(--border-light);
    text-align: center;
}

.error-container h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--danger);
    margin-bottom: 16px;
}

.error-container p {
    font-size: 14px;
    color: var(--text-medium);
    margin-bottom: 24px;
    line-height: 1.6;
}

@media (max-width: 1024px) {
    .visualization-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .viz-info {
        grid-column: 1;
        grid-row: 3;
        border-left: none;
        border-top: 1px solid var(--border-light);
        max-height: 300px;
    }
}

/* ── Wizard Progress Bar ─────────────────────────────────────────────────── */
.wizard-progress {
    display: flex;
    align-items: center;
    padding: 16px 24px 20px;
    background: var(--bg-gray);
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
    gap: 0;
}
.wizard-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.wizard-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid var(--border-light);
    background: var(--bg-white);
    color: var(--text-light);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.wizard-step-label {
    font-size: 11px;
    color: var(--text-light);
    white-space: nowrap;
    transition: color 0.2s;
}
.wizard-progress-connector {
    flex: 1;
    height: 2px;
    background: var(--border-light);
    min-width: 16px;
    margin-bottom: 18px;
    transition: background 0.2s;
}
.wizard-progress-step.completed .wizard-step-circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}
.wizard-progress-step.completed .wizard-step-label {
    color: var(--primary-color);
}
.wizard-progress-connector.completed {
    background: var(--primary-color);
}
.wizard-progress-step.active .wizard-step-circle {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}
.wizard-progress-step.active .wizard-step-label {
    color: var(--text-dark);
    font-weight: 600;
}

/* ── Boundary Condition Cards (Step 6) ───────────────────────────────────── */
.bc-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.bc-card {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-white);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}
.bc-card.is-input { border-color: var(--secondary-color); }

.bc-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-gray);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    user-select: none;
}

.bc-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-medium);
    background: var(--border-light);
    border-radius: 4px;
    padding: 2px 7px;
    min-width: 22px;
    text-align: center;
}
.bc-card.is-input .bc-badge {
    background: var(--secondary-color);
    color: #fff;
}

.bc-name-input {
    flex: 1;
    min-width: 80px;
    max-width: 160px;
    height: 28px;
    box-sizing: border-box;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 3px 7px;
    color: var(--text-dark);
    font-size: 0.85rem;
    font-weight: 600;
    transition: border-color 0.2s;
}
.bc-name-input:focus {
    border-color: var(--secondary-color);
    outline: none;
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.bc-type-select {
    min-width: 80px;
    max-width: 160px;
    height: 28px;
    box-sizing: border-box;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 3px 7px;
    color: var(--text-dark);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s;
}
.bc-type-select:focus { border-color: var(--secondary-color); outline: none; }

.bc-toggle {
    margin-left: auto;
    color: var(--text-light);
    font-size: 0.75rem;
    padding: 2px 6px;
}

.bc-remove-btn {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.25);
    color: var(--danger);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 5px;
    transition: all 0.2s;
}
.bc-remove-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.bc-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.bc-section { padding: 12px 14px; }
.bc-section + .bc-section { border-left: 1px solid var(--border-light); }

.bc-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-light);
    margin-bottom: 8px;
}

.bc-row {
    display: grid;
    gap: 5px 8px;
    margin-bottom: 2px;
}
.bc-row-2 { grid-template-columns: 1fr 1fr; }
.bc-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.bc-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.bc-field { display: flex; flex-direction: column; gap: 2px; }

.bc-field label {
    font-size: 0.65rem;
    color: var(--text-light);
    text-align: center;
    pointer-events: none;
}

.bc-field input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    padding: 4px 5px;
    color: var(--text-dark);
    font-size: 0.8rem;
    text-align: center;
    transition: border-color 0.2s;
}
.bc-field input:hover { border-color: var(--accent-color); }
.bc-field input:focus {
    border-color: var(--secondary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.bc-field.disabled label { opacity: 0.35; }
.bc-field.disabled input {
    opacity: 0.35;
    background: var(--bg-gray);
    cursor: not-allowed;
}

.add-bc-btn {
    background: var(--bg-white);
    border: 1px dashed var(--border-light);
    border-radius: 6px;
    color: var(--text-medium);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    width: 100%;
    margin-bottom: 14px;
    transition: all 0.2s;
}
.add-bc-btn:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background: rgba(59,130,246,0.04);
}

@media (max-width: 400px) {
    .bc-card-body { grid-template-columns: 1fr; }
    .bc-section + .bc-section {
        border-left: none;
        border-top: 1px solid var(--border-light);
    }
}

/* ── Advanced details section (Step 7) ───────────────────────────────────── */
details.adv-details {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 16px;
    background: var(--bg-gray);
}
details.adv-details summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-medium);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
details.adv-details summary::before {
    content: '\25B6';
    font-size: 0.7rem;
    transition: transform 0.2s;
    display: inline-block;
}
details.adv-details[open] summary::before { transform: rotate(90deg); }
details.adv-details summary::-webkit-details-marker { display: none; }
.adv-body { padding: 0 14px 12px; }
#out-type-hint {
    font-size: 0.78rem;
    color: var(--text-medium);
    padding: 5px 0;
    font-style: italic;
}
