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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

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

.toast {
    min-width: 250px;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    color: white;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

.toast.error {
    background: #f44336;
}

.toast.info {
    background: #2196f3;
}

.toast.warning {
    background: #ff9800;
}

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

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

/* Login */
.login-card {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: white;
    border-radius: 20px;
    text-align: center;
}

.login-card input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.login-card button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

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

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

.role-badge {
    background: rgba(255,255,255,0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

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

.btn-primary, .btn-secondary, .btn-logout {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s;
}

.btn-primary {
    background: #4caf50;
    color: white;
}

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

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
}

.btn-primary:hover, .btn-secondary:hover {
    transform: translateY(-2px);
}

/* Chart */
.chart-container {
    padding: 20px;
    min-height: 400px;
}

canvas {
    max-height: 400px;
}

/* Table */
.table-container {
    padding: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Status indicators */
.status-up {
    color: #f44336;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-down {
    color: #f44336;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-normal {
    color: #4caf50;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.triangle-up {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 14px solid #f44336;
    display: inline-block;
}

.triangle-down {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 14px solid #f44336;
    display: inline-block;
}

.circle-green {
    width: 14px;
    height: 14px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
}

.bold-text {
    font-weight: bold;
}

/* Range inputs */
.range-inputs {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.range-inputs div {
    flex: 1;
}

.range-inputs label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.range-inputs input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    animation: slideInModal 0.3s;
}

.modal-content.large {
    max-width: 900px;
}

.close {
    float: right;
    font-size: 28px;
    cursor: pointer;
}

@keyframes slideInModal {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.settings-section {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
}

.user-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.user-form input, .user-form select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    flex: 1;
    min-width: 120px;
}

.users-table {
    width: 100%;
    margin-top: 10px;
}

.users-table td, .users-table th {
    padding: 8px;
}

.delete-user, .edit-user {
    padding: 5px 10px;
    margin: 0 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.delete-user {
    background: #f44336;
    color: white;
}

.edit-user {
    background: #2196f3;
    color: white;
}

.error-message {
    color: #f44336;
    margin-top: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 15px;
        flex-direction: column;
        text-align: center;
    }
    
    .header-buttons {
        width: 100%;
        justify-content: center;
    }
    
    th, td {
        padding: 8px;
        font-size: 12px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 20px;
        max-width: none;
    }
    
    .user-form {
        flex-direction: column;
    }
    
    .range-inputs {
        flex-direction: column;
        gap: 10px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}