/* WESIM Dashboard Styles */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --pending-color: #6b7280;
    --background-color: #f9fafb;
    --card-background: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
}

/* Layout */
body {
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
}

.nav-brand a {
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-name {
    color: var(--text-muted);
}

.logout-link {
    color: var(--text-muted);
    font-size: 0.875rem;
}

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

.page-header h1 {
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Cards */
.card {
    background: var(--card-background);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.card h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.card.full-width {
    grid-column: 1 / -1;
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--card-background);
    color: var(--text-color);
    transition: all 0.15s;
}

.button:hover {
    background: var(--background-color);
}

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

.button.primary:hover {
    background: var(--primary-dark);
}

.button.danger {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.button.small {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-completed, .status-success {
    background: #dcfce7;
    color: #166534;
}

.status-running, .status-in_progress {
    background: #dbeafe;
    color: #1e40af;
}

.status-pending, .status-created {
    background: #f3f4f6;
    color: #6b7280;
}

.status-failed, .status-error {
    background: #fee2e2;
    color: #dc2626;
}

.status-cancelled {
    background: #fef3c7;
    color: #d97706;
}

.status-partial {
    background: #fef3c7;
    color: #92400e;
}

.status-unknown {
    background: #f3f4f6;
    color: #6b7280;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

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

/* Radio buttons */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.radio-label input {
    margin-top: 0.25rem;
}

.radio-label span {
    display: flex;
    flex-direction: column;
}

.radio-label small {
    color: var(--text-muted);
}

/* Progress bar */
.progress-bar {
    height: 8px;
    background: var(--background-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

/* Step list */
.step-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    background: var(--background-color);
}

.step-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.step-item.step-completed .step-icon {
    color: var(--success-color);
}

.step-item.step-running .step-icon {
    color: var(--primary-color);
}

.step-details {
    flex: 1;
}

.step-details h3 {
    margin: 0;
    font-size: 0.875rem;
}

.step-details p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state h2 {
    color: var(--text-color);
}

/* Error/Warning messages */
.error-message {
    padding: 1rem;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    margin-bottom: 1rem;
}

.warning-message {
    padding: 1rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    color: #d97706;
    margin-bottom: 1rem;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
}

.login-container {
    padding: 2rem;
}

.login-box {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
}

.login-box h1 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.login-box .subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s;
}

.login-button:hover {
    background: var(--background-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.domain-notice {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Plot gallery */
.plot-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.plot-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.plot-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.plot-info {
    padding: 0.5rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.plot-name {
    font-weight: 500;
}

.plot-meta {
    color: var(--text-muted);
}

/* Grids */
.run-detail-grid,
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Config list */
.config-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 1rem;
}

.config-list dt {
    font-weight: 500;
    color: var(--text-muted);
}

.config-list dd {
    margin: 0;
}

/* Stats list */
.stats-list {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
}

.stats-list dt {
    color: var(--text-muted);
}

.stats-list dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
}

/* Fire chips */
.fire-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.chip {
    display: inline-flex;
    flex-direction: column;
    padding: 0.25rem 0.5rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s;
}

.chip:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.chip small {
    font-size: 0.625rem;
    color: inherit;
    opacity: 0.7;
}

/* Date/hour list */
.date-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.date-item {
    padding: 0.75rem;
    background: var(--background-color);
    border-radius: 6px;
}

.hour-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.hour-pill {
    padding: 0.125rem 0.375rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* Type badges */
.type-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.type-system {
    background: #dbeafe;
    color: #1e40af;
}

.type-uploaded {
    background: #dcfce7;
    color: #166534;
}

/* Responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .form-row {
        flex-direction: column;
    }

    nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}
