/* WaybillPrinter Dashboard Styles */

:root {
    --primary-color: #1976D2;
    --primary-dark: #1565C0;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #F44336;
    --text-color: #333;
    --text-muted: #666;
    --border-color: #ddd;
    --bg-light: #f5f5f5;
    --bg-white: #fff;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

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

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

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

.btn-secondary {
    background-color: #e0e0e0;
    color: var(--text-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Sections */
.section {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.section h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

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

.station-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.station-card.online {
    border-left: 4px solid var(--success-color);
}

.station-card.offline {
    border-left: 4px solid var(--danger-color);
}

.station-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--danger-color);
}

.station-card.online .status-dot {
    background-color: var(--success-color);
}

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

.station-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.station-lastseen {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Jobs Table */
.jobs-table {
    width: 100%;
    border-collapse: collapse;
}

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

.jobs-table th {
    background-color: var(--bg-light);
    font-weight: 600;
    font-size: 0.875rem;
}

.jobs-table tr:hover {
    background-color: #f9f9f9;
}

.jobs-table .actions {
    white-space: nowrap;
}

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

.status-badge.status-new { background-color: #E3F2FD; color: #1976D2; }
.status-badge.status-sent { background-color: #FFF3E0; color: #F57C00; }
.status-badge.status-received { background-color: #E8F5E9; color: #388E3C; }
.status-badge.status-printing { background-color: #FCE4EC; color: #C2185B; }
.status-badge.status-printed { background-color: #E8F5E9; color: #2E7D32; }
.status-badge.status-error { background-color: #FFEBEE; color: #C62828; }
.status-badge.status-cancelled { background-color: #ECEFF1; color: #546E7A; }

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    align-items: flex-end;
}

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

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.filter-group input,
.filter-group select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

.pagination-buttons button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: 4px;
    cursor: pointer;
}

.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

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

/* Detail View */
.detail-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.detail-row .label {
    width: 120px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.detail-row.error {
    color: var(--danger-color);
}

/* Events List */
.events-list {
    max-height: 200px;
    overflow-y: auto;
}

.event-item {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.875rem;
}

.event-time {
    color: var(--text-muted);
}

.event-type {
    font-weight: 500;
}

.event-client {
    color: var(--text-muted);
}

/* Station Detail Cards */
.stations-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
}

.station-detail-card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.station-detail-card.online {
    border-top: 4px solid var(--success-color);
}

.station-detail-card.offline {
    border-top: 4px solid var(--danger-color);
}

.station-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-light);
}

.station-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--danger-color);
}

.station-detail-card.online .status-indicator {
    background-color: var(--success-color);
}

.station-type {
    color: var(--text-muted);
    font-size: 0.75rem;
}

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

.station-detail-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
}

.station-info .info-row {
    display: flex;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.station-info .label {
    width: 100px;
    color: var(--text-muted);
}

.station-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.station-stats .stat {
    text-align: center;
    padding: 0.5rem;
    background: var(--bg-light);
    border-radius: 4px;
}

.station-stats .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.station-stats .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Token Display */
.warning-box {
    background: #FFF3E0;
    color: #E65100;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.token-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.token-display code {
    flex: 1;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.875rem;
}

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

/* Utility */
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-muted { color: var(--text-muted); }

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

.error-message {
    color: var(--danger-color);
    background: #FFEBEE;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filters {
        flex-direction: column;
    }
    
    .station-detail-body {
        grid-template-columns: 1fr;
    }
    
    .jobs-table {
        font-size: 0.75rem;
    }
    
    .jobs-table th,
    .jobs-table td {
        padding: 0.5rem;
    }
}
