/* WMS2 PWA Styles - Ottimizzato per Zebra */

:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --danger: #f44336;
    --warning: #ff9800;
    --success: #4CAF50;
    --info: #2196F3;
    --bg: #1a1a1a;
    --bg-light: #2a2a2a;
    --bg-lighter: #3a3a3a;
    --text: #ffffff;
    --text-muted: #aaaaaa;
    --border: #444444;
}

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

html,
body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 18px;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

/* Scanner input nascosto */
.scan-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Status bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.status-user {
    font-weight: bold;
}

.status-sync {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-indicator.online {
    background: var(--success);
}

.status-indicator.offline {
    background: var(--danger);
}

.pending-count {
    background: var(--warning);
    color: #000;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

/* App container */
#app {
    padding: 16px;
    min-height: calc(100vh - 50px);
}

/* Screen header */
.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.screen-header h2 {
    font-size: 24px;
    font-weight: bold;
}

/* Stato indicator */
.stato-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid var(--primary);
}

.stato-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.stato-text {
    font-size: 18px;
    flex: 1;
}

/* Info box */
.info-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-lighter);
    border-radius: 8px;
    margin-bottom: 12px;
}

.info-box .label {
    color: var(--text-muted);
    font-size: 14px;
}

.info-box .value {
    font-size: 20px;
    font-weight: bold;
    font-family: monospace;
}

/* Section title */
.section-title {
    font-size: 14px;
    color: var(--text-muted);
    margin: 16px 0 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Articoli list */
.articoli-list {
    margin: 16px 0;
}

.articolo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
}

.articolo-item.tappable {
    cursor: pointer;
    transition: background 0.2s;
}

.articolo-item.tappable:active {
    background: var(--primary-dark);
}

.articolo-item.already-selected {
    opacity: 0.5;
    border-left: 3px solid var(--primary);
}

.articoli-list.selected .articolo-item {
    border-left: 3px solid var(--success);
}

.articolo-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.articolo-barcode {
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
}

.articolo-nome {
    font-size: 14px;
    color: var(--text);
}

.articolo-descr {
    font-size: 12px;
    color: var(--text-muted);
}

.articolo-disp {
    font-size: 12px;
    color: var(--text-muted);
}

.articolo-stock {
    display: flex;
    align-items: center;
}

.qty-badge {
    background: var(--primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 16px;
}

.articolo-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-value {
    font-size: 24px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}

.articolo-codebars {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:active {
    transform: scale(0.95);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

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

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

.btn-secondary {
    background: var(--bg-lighter);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

/* Actions */
.actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
}

.actions .btn {
    flex: 1;
}

/* Login */
.login-screen {
    max-width: 400px;
    margin: 40px auto;
    padding: 24px;
}

.login-screen h1 {
    text-align: center;
    font-size: 48px;
    margin-bottom: 32px;
    color: var(--primary);
}

.login-form {
    background: var(--bg-light);
    padding: 24px;
    border-radius: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.login-form .btn {
    width: 100%;
    margin-top: 16px;
}

.error-message {
    color: var(--danger);
    text-align: center;
    margin-top: 16px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    max-width: 90vw;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: var(--success);
    color: #fff;
}

.toast-error {
    background: var(--danger);
    color: #fff;
}

.toast-warning {
    background: var(--warning);
    color: #000;
}

.toast-info {
    background: var(--info);
    color: #fff;
}

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loader-content {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-lighter);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.loader-message {
    color: var(--text);
    font-size: 16px;
}