/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* App Layout */
#app {
    display: flex;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    background: #f5f5f5;
}

/* Navigation Sidebar */
.app-nav {
    width: 260px;
    background: #1e293b;
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
}

.nav-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Mobile Nav Toggle (outside nav) */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: #1976D2;
    border: none;
    color: white;
    font-size: 1.8rem;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.mobile-nav-toggle:active {
    transform: scale(0.95);
}

.nav-menu {
    flex: 1;
    list-style: none;
    padding: 10px 0;
    overflow-y: auto;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.nav-link.active {
    background: rgba(33, 150, 243, 0.1);
    color: #2196F3;
    border-left-color: #2196F3;
}

.nav-icon {
    font-size: 1.2rem;
}

.nav-text {
    font-size: 0.95rem;
}

.nav-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.nav-user-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.nav-user-info span:first-child {
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    width: fit-content;
}

.badge-admin {
    background: #f44336;
    color: white;
}

.badge-operator {
    background: #2196F3;
    color: white;
}

.badge-viewer {
    background: #9e9e9e;
    color: white;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Container */
.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

/* Login Screen */
.login-card {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.app-title {
    font-size: 2rem;
    color: #2196F3;
    margin-bottom: 30px;
    font-weight: 700;
}

/* Header */
.header {
    background: #2196F3;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2196F3;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #2196F3;
    color: white;
}

.btn-primary:hover {
    background: #1976D2;
}

.btn-secondary {
    background: #4CAF50;
    color: white;
}

.btn-secondary:hover {
    background: #45a049;
}

.btn-outline {
    background: transparent;
    color: #2196F3;
    border: 2px solid #2196F3;
}

.btn-outline:hover {
    background: #2196F3;
    color: white;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    margin-bottom: 20px;
}

/* Recent Scans */
.recent-scans {
    margin-top: 30px;
}

.recent-scans h3 {
    margin-bottom: 15px;
    color: #555;
}

.scans-list {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.scan-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scan-item:last-child {
    border-bottom: none;
}

.scan-info {
    flex: 1;
}

.scan-barcode {
    font-weight: 500;
    color: #333;
}

.scan-details {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.scan-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.scan-status.synced {
    background: #e8f5e8;
    color: #4CAF50;
}

.scan-status.pending {
    background: #fff3e0;
    color: #FF9800;
}

/* Sync Status */
.sync-status {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s;
}

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

.toast.success {
    background: #4CAF50;
}

.toast.error {
    background: #f44336;
}

.toast.warning {
    background: #FF9800;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

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

.loading-content p {
    margin-top: 20px;
    color: #666;
}

/* Login Container */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.app-title {
    text-align: center;
    font-size: 2rem;
    color: #333;
    margin-bottom: 10px;
}

.app-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: #999;
}

/* Scanner Container */
.scanner-container {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

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

.recent-scans-section {
    margin-top: 30px;
}

.scans-list {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table thead {
    background: #f5f5f5;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #ddd;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

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

.data-table tr.clickable {
    cursor: pointer;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-nav {
        position: fixed;
        left: -260px;
        height: 100vh;
        transition: left 0.3s;
        z-index: 1000;
    }
    
    .app-nav.show {
        left: 0;
    }
    
    .nav-toggle {
        display: block;
    }
    
    .mobile-nav-toggle {
        display: block;
    }
    
    .nav-menu {
        display: block !important;
    }
    
    .app-content {
        width: 100%;
    }
    
    .container {
        padding: 10px;
    }
    
    .login-card {
        padding: 30px 20px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .scanner-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .user-info {
        flex-direction: column;
        width: 100%;
    }
}

/* Animation for mode changes */
.quantity-group-hidden {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s;
}

.quantity-group-visible {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s;
}
