/* Stickwerk Frontend Styles */

:root {
    --stickwerk-primary: #2563eb;
    --stickwerk-secondary: #64748b;
    --stickwerk-success: #10b981;
    --stickwerk-warning: #f59e0b;
    --stickwerk-danger: #ef4444;
    --stickwerk-bg: #ffffff;
    --stickwerk-surface: #f8fafc;
    --stickwerk-border: #e2e8f0;
    --stickwerk-text: #1e293b;
    --stickwerk-text-muted: #64748b;
}

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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--stickwerk-border);
}

.page-header h1 {
    font-size: 2rem;
    color: var(--stickwerk-text);
}

/* Navigation */
.nav {
    background: var(--stickwerk-surface);
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav a[style*="margin-left: auto"] {
    margin-left: auto !important;
}

.nav a {
    color: var(--stickwerk-text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav a:hover,
.nav a.active {
    background: var(--stickwerk-primary);
    color: white;
}

/* Cards */
.card {
    background: var(--stickwerk-bg);
    border: 1px solid var(--stickwerk-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--stickwerk-border);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

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

.table th {
    background: var(--stickwerk-surface);
    font-weight: 600;
    color: var(--stickwerk-text);
}

.table tr:hover {
    background: var(--stickwerk-surface);
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-idle {
    background: #dbeafe;
    color: #1e40af;
}

.badge-running {
    background: #d1fae5;
    color: #065f46;
}

.badge-maintenance {
    background: #fef3c7;
    color: #92400e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--stickwerk-text);
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--stickwerk-border);
    border-radius: 4px;
    font-size: 1rem;
}

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

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background: #1d4ed8;
}

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

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

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

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Machine Cards */
.machine-card {
    border: 2px solid var(--stickwerk-border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s;
}

.machine-card.running {
    border-color: var(--stickwerk-success);
    background: #f0fdf4;
}

.machine-card.maintenance {
    border-color: var(--stickwerk-warning);
    background: #fffbeb;
}

.machine-card.error {
    border-color: var(--stickwerk-danger);
    background: #fef2f2;
}

.machine-status-buttons .btn {
    flex: 1;
    min-width: 80px;
}

.machine-info {
    font-size: 0.9375rem;
}

.machine-info p {
    margin: 0.5rem 0;
}

/* Color Swatch */
.color-swatch {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 1px solid var(--stickwerk-border);
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Inventory Warning */
.inventory-low {
    background: #fef2f2;
    border-left: 4px solid var(--stickwerk-danger);
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--stickwerk-text-muted);
}

/* Production Dashboard */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
}

.order-card {
    border: 2px solid var(--stickwerk-border);
    border-radius: 8px;
    padding: 1rem;
    background: var(--stickwerk-bg);
    transition: all 0.2s;
    position: relative;
}

.order-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.order-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 8px 0 0 8px;
}

.order-card.status-green::before {
    background: var(--stickwerk-success);
}

.order-card.status-yellow::before {
    background: var(--stickwerk-warning);
}

.order-card.status-red::before {
    background: var(--stickwerk-danger);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.order-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.order-number {
    font-size: 0.875rem;
    color: var(--stickwerk-text-muted);
}

.production-status {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.production-status.green {
    background: var(--stickwerk-success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.production-status.yellow {
    background: var(--stickwerk-warning);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.production-status.red {
    background: var(--stickwerk-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.order-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.order-info-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.order-info-label {
    color: var(--stickwerk-text-muted);
    font-weight: 500;
}

.order-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.order-actions select {
    flex: 1;
    min-width: 150px;
    padding: 0.375rem;
    border: 1px solid var(--stickwerk-border);
    border-radius: 4px;
    font-size: 0.875rem;
}

.priority-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.priority-normal {
    background: #e0e7ff;
    color: #3730a3;
}

.priority-hoch {
    background: #fef3c7;
    color: #92400e;
}

.priority-express {
    background: #fee2e2;
    color: #991b1b;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .orders-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
