* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ========== LOGIN PAGE ========== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    width: 400px;
    max-width: 90%;
}

.login-icon {
    font-size: 60px;
    color: #667eea;
    margin-bottom: 20px;
}

.login-box h2 {
    color: #333;
    margin-bottom: 10px;
}

.login-box p {
    color: #666;
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 10px;
    margin-bottom: 15px;
    padding: 5px 15px;
}

.input-group i {
    color: #667eea;
    font-size: 18px;
}

.input-group input {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
}

.login-box button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.login-box button:hover {
    transform: translateY(-2px);
}

.error {
    color: #f44336;
    margin-top: 15px;
    font-size: 14px;
}

.demo-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #999;
}

/* ========== NAVBAR ========== */
.navbar {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.nav-brand i {
    margin-right: 10px;
}

.nav-menu {
    display: flex;
    gap: 10px;
}

.nav-item {
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s;
    color: #666;
}

.nav-item i {
    margin-right: 8px;
}

.nav-item:hover {
    background: #f0f0f0;
}

.nav-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.role-badge {
    background: #e0e0e0;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.logout-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #f0f0f0;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== DASHBOARD GRID ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.card.full-width {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.card-header h3 {
    color: #333;
}

.card-header h3 i {
    color: #667eea;
    margin-right: 8px;
}

/* Weight Card */
.weight-card {
    text-align: center;
}

.weight-display {
    font-size: 72px;
    font-weight: bold;
    color: #4caf50;
    margin: 20px 0;
}

.weight-unit {
    color: #666;
    margin-bottom: 10px;
}

.live-badge {
    background: #ff4757;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.live-badge i {
    font-size: 10px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.last-update {
    font-size: 12px;
    color: #999;
}

/* Device Status */
.device-status {
    margin-bottom: 15px;
}

.status-online {
    color: #4caf50;
}

.status-offline {
    color: #f44336;
}

.device-details p {
    margin: 8px 0;
    font-size: 14px;
}

.device-details i {
    width: 25px;
    color: #667eea;
}

/* Stats */
.stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

/* ========== BUTTONS ========== */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-gross {
    background: #ffc107;
    color: #333;
}

.btn-tare {
    background: #17a2b8;
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* ========== TABLES ========== */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.text-center {
    text-align: center;
}

/* ========== MODALS ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    width: 500px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #667eea;
}

.modal-content h2 i {
    margin-right: 10px;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.weight-inputs {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
}

.current-weight-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.current-weight-value {
    font-size: 28px;
    font-weight: bold;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons .btn {
    flex: 1;
}

/* ========== DEVICES GRID ========== */
.devices-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.devices-header h2 {
    color: white;
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.device-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    transition: transform 0.3s;
}

.device-card:hover {
    transform: translateY(-5px);
}

.device-card.online {
    border-left: 4px solid #4caf50;
}

.device-card.offline {
    border-left: 4px solid #f44336;
}

.device-card h4 {
    margin-bottom: 10px;
}

.device-card p {
    margin: 5px 0;
    font-size: 14px;
    color: #666;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .weight-display {
        font-size: 48px;
    }
}