* {
    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, #e8f4fc 0%, #f5f9fc 100%);
    min-height: 100vh;
    color: #333;
}

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 {
    color: #1e88e5;
    font-size: 28px;
    margin-bottom: 10px;
}

.login-subtitle {
    color: #757575;
    margin-bottom: 30px;
}

.login-box input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 16px;
    transition: border-color 0.3s ease;
}

.login-box input:focus {
    outline: none;
    border-color: #1e88e5;
}

.login-error {
    color: #ef5350;
    margin-top: 16px;
    font-size: 14px;
}

.btn-full {
    width: 100%;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
    color: white;
    padding: 25px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(30, 136, 229, 0.3);
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
}

.header-info {
    display: flex;
    gap: 15px;
    font-size: 14px;
    align-items: center;
}

.header-info span {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
}

.header-info .clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.header-info .clickable:hover {
    background: rgba(255, 255, 255, 0.35);
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: white;
    color: #1e88e5;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-btn:hover {
    background: #e3f2fd;
}

.tab-btn.active {
    background: #1e88e5;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #1e88e5;
    color: white;
}

.btn-primary:hover {
    background: #1565c0;
}

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

.btn-secondary:hover {
    background: #1e88e5;
}

.btn-danger {
    background: #ef5350;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-success {
    background: #66bb6a;
    color: white;
}

.btn-success:hover {
    background: #43a047;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.device-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    border-left: 4px solid #1e88e5;
}

.device-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.device-card.offline {
    border-left-color: #bdbdbd;
    opacity: 0.7;
}

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

.device-brand {
    font-size: 18px;
    font-weight: 600;
    color: #1e88e5;
}

.device-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.device-status.online {
    background: #e8f5e9;
    color: #43a047;
}

.device-status.offline {
    background: #fafafa;
    color: #9e9e9e;
}

.device-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}

.device-info-row:last-child {
    border-bottom: none;
}

.device-info-label {
    color: #757575;
}

.device-info-value {
    color: #333;
    font-weight: 500;
}

.commands-list, .history-list, .admins-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.command-item, .history-item, .admin-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.command-item:last-child, .history-item:last-child, .admin-item:last-child {
    border-bottom: none;
}

.command-info, .history-info, .admin-info {
    flex: 1;
}

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

.command-device {
    font-size: 12px;
    color: #1e88e5;
}

.command-status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

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

.status-executing {
    background: #e3f2fd;
    color: #1e88e5;
}

.status-completed {
    background: #e8f5e9;
    color: #43a047;
}

.command-text, .history-text {
    font-family: 'Consolas', 'Monaco', monospace;
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 8px;
    word-break: break-all;
}

.command-time, .history-time, .admin-time {
    font-size: 12px;
    color: #9e9e9e;
    margin-top: 4px;
}

.command-actions, .admin-actions {
    display: flex;
    gap: 8px;
}

.admin-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.admin-user-id {
    font-size: 13px;
    color: #1e88e5;
    font-family: 'Consolas', 'Monaco', monospace;
}

.admin-role {
    font-size: 12px;
    color: #757575;
    margin-top: 4px;
}

.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.active {
    display: flex;
}

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

.profile-modal-content {
    max-width: 500px;
    max-height: 600px;
}

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

.modal-header h2 {
    color: #1e88e5;
    font-size: 20px;
}

.close {
    font-size: 28px;
    color: #9e9e9e;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

.device-info {
    background: #f5f9fc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.device-info h3 {
    color: #1e88e5;
    margin-bottom: 15px;
    font-size: 16px;
}

.command-input {
    margin-bottom: 20px;
}

.command-input h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 16px;
}

.command-input textarea {
    width: 100%;
    height: 100px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.command-input textarea:focus {
    outline: none;
    border-color: #1e88e5;
}

.command-templates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.template-btn {
    padding: 6px 12px;
    background: #e3f2fd;
    color: #1e88e5;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-btn:hover {
    background: #bbdefb;
}

.device-history {
    margin-top: 20px;
}

.device-history h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 16px;
}

#deviceHistory {
    max-height: 300px;
    overflow-y: auto;
}

.history-output {
    background: #263238;
    color: #aed581;
    padding: 12px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 150px;
    overflow-y: auto;
}

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

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

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #1e88e5;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9e9e9e;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.settings-panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    max-width: 600px;
}

.settings-panel h3 {
    color: #1e88e5;
    font-size: 20px;
    margin-bottom: 8px;
}

.settings-desc {
    color: #757575;
    font-size: 14px;
    margin-bottom: 25px;
}

.settings-panel .form-group {
    margin-bottom: 24px;
}

.settings-panel .form-group label {
    font-size: 15px;
    color: #333;
}

.settings-panel .form-group input {
    width: 200px;
    padding: 12px 14px;
    font-size: 16px;
}

.settings-panel .hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #9e9e9e;
}

.status-msg {
    margin-left: 15px;
    font-size: 14px;
}

.status-msg.success {
    color: #43a047;
}

.status-msg.error {
    color: #ef5350;
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-info {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .devices-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 100px;
    }
}
