/**
 * TruckCall Light Frontend Styles
 * Mobile-optimized CSS for dashboard and forms
 */

/* Reset and Base Styles */
.truckcall-dashboard *,
.truckcall-create-form * {
    box-sizing: border-box;
}

/* Dashboard Styles */
.truckcall-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.truckcall-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.truckcall-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

.truckcall-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-role {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-role.schichtleiter {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-role.fahrer {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

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

/* Filters */
.truckcall-filters {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

.filter-group select {
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Aufträge Columns Layout */
.truckcall-auftraege-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    min-height: 600px;
}

.status-column {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e9ecef;
}

.status-column.status-offen {
    border-color: #dc3545;
}

.status-column.status-akzeptiert {
    border-color: #17a2b8;
}

.status-column.status-in_arbeit {
    border-color: #ffc107;
}

.status-column.status-erledigt {
    border-color: #28a745;
}

.column-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-column.status-offen .column-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.status-column.status-akzeptiert .column-header {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.status-column.status-in_arbeit .column-header {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #333;
}

.status-column.status-erledigt .column-header {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.column-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.column-header .count {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.column-content {
    padding: 15px;
    max-height: 70vh;
    overflow-y: auto;
}

.no-auftraege-column {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-auftraege-column p {
    margin: 0;
    font-style: italic;
}

/* Auftrag Cards */
.truckcall-auftrag-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 4px solid #e1e5e9;
}

.truckcall-auftrag-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

/* Status-based card styling */
.truckcall-auftrag-card.status-offen {
    border-left-color: #dc3545;
}

.truckcall-auftrag-card.status-akzeptiert {
    border-left-color: #17a2b8;
}

.truckcall-auftrag-card.status-in_arbeit {
    border-left-color: #ffc107;
}

.truckcall-auftrag-card.status-erledigt {
    border-left-color: #28a745;
}

.truckcall-auftrag-card.status-abgelehnt {
    border-left-color: #6c757d;
}

/* Priority-based card accent */
.truckcall-auftrag-card.priority-hoch::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-top: 20px solid #dc3545;
}

.card-header {
    padding: 20px 20px 15px;
    border-bottom: 1px solid #f8f9fa;
}

.auftrag-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.auftrag-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-badge,
.priority-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-offen {
    background: #fee;
    color: #dc3545;
    border: 1px solid #f5c6cb;
}

.status-badge.status-akzeptiert {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #b8daff;
}

.status-badge.status-in_arbeit {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.status-erledigt {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.status-abgelehnt {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.priority-badge.priority-niedrig {
    background: #e2e3e5;
    color: #6c757d;
}

.priority-badge.priority-mittel {
    background: #fff3cd;
    color: #856404;
}

.priority-badge.priority-hoch {
    background: #f8d7da;
    color: #721c24;
}

.card-content {
    padding: 15px 20px;
}

.auftrag-description {
    margin-bottom: 15px;
    color: #666;
    line-height: 1.5;
}

.auftrag-details {
    margin-bottom: 15px;
}

.detail-row {
    display: flex;
    margin-bottom: 8px;
    font-size: 14px;
}

.detail-row strong {
    min-width: 120px;
    color: #333;
    font-weight: 600;
}

.auftrag-attachments,
.auftrag-comments {
    margin-bottom: 15px;
}

.auftrag-attachments strong,
.auftrag-comments strong {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-link {
    padding: 6px 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    text-decoration: none;
    color: #495057;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.attachment-link:hover {
    background: #e9ecef;
    text-decoration: none;
}

/* Card Actions */
.card-actions {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.status-actions {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.status-actions .button {
    flex: 1;
    min-width: 120px;
    margin: 0;
}

/* Route Information Styling */
.route-info .route {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.route .arrow {
    color: #667eea;
    font-weight: bold;
    font-size: 16px;
}

.route .von-ort,
.route .zu-ort {
    background: #e3f2fd;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: #1565c0;
}

.comment-section textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 10px;
}

.comment-section textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.button {
    display: inline-block;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center;
}

.button:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.button-primary {
    background: #667eea;
}

.button-primary:hover {
    background: #5a6fd8;
}

.button-success {
    background: #28a745;
}

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

.button-danger {
    background: #dc3545;
}

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

.button:not(.button-primary):not(.button-success):not(.button-danger) {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.button:not(.button-primary):not(.button-success):not(.button-danger):hover {
    background: #e9ecef;
}

/* Create Form Styles */
.truckcall-create-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.truckcall-create-form h2 {
    margin: 0 0 30px;
    font-size: 28px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.truckcall-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.form-group .description {
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

.form-actions {
    padding-top: 20px;
    text-align: center;
}

.form-actions .button {
    min-width: 200px;
    padding: 14px 24px;
    font-size: 16px;
}

/* Messages */
.truckcall-error,
.truckcall-success {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.truckcall-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.truckcall-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.no-auftraege {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    grid-column: 1 / -1;
}

.no-auftraege p {
    font-size: 18px;
    margin: 0;
}

/* Loading States */
.truckcall-loading {
    opacity: 0.6;
    pointer-events: none;
}

.truckcall-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .truckcall-dashboard {
        padding: 15px;
    }
    
    .truckcall-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px 15px;
    }
    
    .truckcall-header h2 {
        font-size: 24px;
    }
    
    .truckcall-auftraege-columns {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .column-content {
        max-height: 50vh;
    }
    
    .filter-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .truckcall-create-form {
        margin: 15px;
        padding: 20px 15px;
    }
    
    .button {
        min-height: 48px; /* Larger touch targets on mobile */
        font-size: 16px;
    }
    
    .card-actions {
        padding: 15px;
    }
    
    .status-actions {
        flex-direction: column;
    }
    
    .status-actions .button {
        width: 100%;
        margin-bottom: 10px;
        min-width: auto;
    }
    
    .admin-actions .button {
        width: 100%;
    }
    
    .truckcall-message {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .truckcall-dashboard {
        padding: 10px;
    }
    
    .truckcall-header {
        padding: 15px 10px;
    }
    
    .truckcall-header h2 {
        font-size: 20px;
    }
    
    .truckcall-create-form {
        margin: 10px;
        padding: 15px 10px;
    }
    
    .auftrag-title {
        font-size: 16px;
    }
    
    .card-header,
    .card-content,
    .card-actions {
        padding: 15px;
    }
}

/* Message Notifications */
.truckcall-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.truckcall-message-success {
    background: #28a745;
}

.truckcall-message-error {
    background: #dc3545;
}

.truckcall-message-info {
    background: #17a2b8;
}

.truckcall-message-warning {
    background: #ffc107;
    color: #333;
}

/* File Preview */
.file-preview {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}

.file-info:last-child {
    border-bottom: none;
}

.file-name {
    font-weight: 500;
    color: #495057;
}

.file-size {
    color: #6c757d;
    font-size: 12px;
}

/* Print Styles */
@media print {
    .truckcall-filters,
    .card-actions {
        display: none;
    }
    
    .truckcall-auftrag-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
